Skip to content

Commit 3609a80

Browse files
tbidnetomjaguarpaw
authored andcommitted
Add System.Process.OsString module
Bumps lower bounds for base, filepath, unix, and Win32. Drops support for GHC < 8.6, as required by newer Win32.
1 parent 1d5e891 commit 3609a80

File tree

4 files changed

+63
-17
lines changed

4 files changed

+63
-17
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,8 @@ jobs:
2929
- '8.10'
3030
- '8.8'
3131
- '8.6'
32-
- '8.4'
33-
- '8.2'
3432

3533
exclude:
36-
# Exclude GHC 8.2 on Windows (GHC bug: undefined reference to `__stdio_common_vswprintf_s')
37-
- platform:
38-
os: windows-latest
39-
ghc-version: '8.2'
40-
4134
# Only allow ARM jobs with GHC >= 9.2
4235
# (It's tedious to not be able to use matrix.ghc-version >= 9.2 as a conditional here.)
4336
- platform:
@@ -52,12 +45,6 @@ jobs:
5245
- platform:
5346
arch: arm
5447
ghc-version: '8.6'
55-
- platform:
56-
arch: arm
57-
ghc-version: '8.4'
58-
- platform:
59-
arch: arm
60-
ghc-version: '8.2'
6148

6249
steps:
6350
- uses: actions/checkout@v4
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE PackageImports #-}
3+
4+
-- | Miscellaneous information about the system environment, for 'OsString'.
5+
--
6+
-- @since X.Y.Z
7+
module System.Process.Environment.OsString (
8+
getArgs,
9+
getEnv,
10+
getEnvironment,
11+
) where
12+
13+
import Data.Coerce (coerce)
14+
#if MIN_VERSION_filepath(1, 5, 0)
15+
import "os-string" System.OsString.Internal.Types (OsString(OsString))
16+
#else
17+
import "filepath" System.OsString.Internal.Types (OsString(OsString))
18+
#endif
19+
#if defined(mingw32_HOST_OS)
20+
import qualified System.Win32.WindowsString.Console as Platform
21+
#else
22+
import qualified System.Posix.Env.PosixString as Platform
23+
#endif
24+
25+
-- | 'System.Environment.getArgs' for 'OsString'.
26+
--
27+
-- @since X.Y.Z
28+
getArgs :: IO [OsString]
29+
getArgs = coerce Platform.getArgs
30+
31+
-- | 'System.Environment.getEnv' for 'OsString'.
32+
--
33+
-- @since X.Y.Z
34+
getEnv :: OsString -> IO (Maybe OsString)
35+
getEnv = coerce Platform.getEnv
36+
37+
-- | 'System.Environment.getEnvironment' for 'OsString'.
38+
--
39+
-- @since X.Y.Z
40+
getEnvironment :: IO [(OsString, OsString)]
41+
getEnvironment = coerce Platform.getEnvironment

changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog for [`process` package](http://hackage.haskell.org/package/process)
22

3+
## X.Y.Z
4+
5+
* Add `System.Process.Environment.OsString`.
6+
* Bumps `base >= 4.12.0.0` (GHC 8.6+), `filepath >= 1.4.100.0`,
7+
`unix >= 2.8.0.0`, and `Win32 >= 2.14.1.0`.
8+
* Drops support for GHC < 8.6.
9+
310
## 1.6.25.0 *September 2024*
411

512
* Fix build with Javascript backend ([#327](https://github.com/haskell/process/issues/327))

process.cabal

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ source-repository head
4141
type: git
4242
location: https://github.com/haskell/process.git
4343

44+
flag os-string
45+
description: Use the new os-string package
46+
default: False
47+
manual: False
48+
4449
library
4550
default-language: Haskell2010
4651
other-extensions:
@@ -56,19 +61,20 @@ library
5661
System.Process
5762
System.Process.CommunicationHandle
5863
System.Process.CommunicationHandle.Internal
64+
System.Process.Environment.OsString
5965
System.Process.Internals
6066
other-modules: System.Process.Common
6167
if os(windows)
6268
c-sources:
6369
cbits/win32/runProcess.c
6470
other-modules: System.Process.Windows
65-
build-depends: Win32 >=2.4 && < 2.15
71+
build-depends: Win32 >= 2.14.1.0 && < 2.15
6672
-- ole32 and rpcrt4 are needed to create GUIDs for unique named pipes
6773
-- for process.
6874
extra-libraries: kernel32, ole32, rpcrt4
6975
cpp-options: -DWINDOWS
7076
else
71-
build-depends: unix >= 2.5 && < 2.9
77+
build-depends: unix >= 2.8.0.0 && < 2.9
7278
if arch(javascript)
7379
js-sources:
7480
jsbits/process.js
@@ -88,7 +94,12 @@ library
8894

8995
ghc-options: -Wall
9096

91-
build-depends: base >= 4.10 && < 4.22,
97+
build-depends: base >= 4.12.0.0 && < 4.22,
9298
directory >= 1.1 && < 1.4,
93-
filepath >= 1.2 && < 1.6,
9499
deepseq >= 1.1 && < 1.6
100+
101+
if flag(os-string)
102+
build-depends: filepath >= 1.5.0.0 && < 1.6,
103+
os-string >= 2.0.0 && < 2.1
104+
else
105+
build-depends: filepath >= 1.4.100.0 && < 1.5.0.0

0 commit comments

Comments
 (0)