Skip to content

Commit 8aff09d

Browse files
committed
Add System.Process.Env(.OsString) modules
1 parent 1d5e891 commit 8aff09d

File tree

4 files changed

+60
-3
lines changed

4 files changed

+60
-3
lines changed

System/Process/Env.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- | Miscellaneous information about the system environment.
2+
--
3+
-- @since X.Y.Z
4+
module System.Process.Env (
5+
Env.getArgs
6+
) where
7+
8+
import qualified System.Environment as Env

System/Process/Env/OsString.hs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
#if !MIN_VERSION_filepath(1,5,0)
4+
-- Silence the warning on System.OsString.Internal.Types import. It exists
5+
-- (deprecated) in filepath 1.4.100.0 && < 1.5.0.0. For filepath >= 1.5,
6+
-- it exists (undeprecated) in os-string.
7+
{-# OPTIONS_GHC -Wno-deprecations #-}
8+
#endif
9+
10+
-- | Miscellaneous information about the system environment, for 'OsString'.
11+
--
12+
-- @since X.Y.Z
13+
module System.Process.Env.OsString (
14+
getArgs
15+
) where
16+
17+
import Data.Coerce (coerce)
18+
#if defined(mingw32_HOST_OS)
19+
import qualified System.Win32.WindowsString.Console as Platform
20+
import System.OsString.Internal.Types
21+
( OsString(OsString), WindowsString(WindowsString) )
22+
#else
23+
import System.OsString.Internal.Types
24+
( OsString(OsString), PosixString(PosixString) )
25+
import qualified System.Posix.Env.PosixString as Platform
26+
#endif
27+
28+
-- | 'System.Environment.getArgs' for 'OsString'.
29+
--
30+
-- @since X.Y.Z
31+
getArgs :: IO [OsString]
32+
getArgs = coerce Platform.getArgs

changelog.md

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

3+
## X.Y.Z
4+
5+
* Add `System.Process.Env` and `System.Process.Env.OsString`. Bumps
6+
`filepath >= 1.4.100.0`.
7+
38
## 1.6.25.0 *September 2024*
49

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

process.cabal

Lines changed: 15 additions & 3 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,21 @@ library
5661
System.Process
5762
System.Process.CommunicationHandle
5863
System.Process.CommunicationHandle.Internal
64+
System.Process.Env
65+
System.Process.Env.OsString
5966
System.Process.Internals
6067
other-modules: System.Process.Common
6168
if os(windows)
6269
c-sources:
6370
cbits/win32/runProcess.c
6471
other-modules: System.Process.Windows
65-
build-depends: Win32 >=2.4 && < 2.15
72+
build-depends: Win32 >=2.14 && < 2.15
6673
-- ole32 and rpcrt4 are needed to create GUIDs for unique named pipes
6774
-- for process.
6875
extra-libraries: kernel32, ole32, rpcrt4
6976
cpp-options: -DWINDOWS
7077
else
71-
build-depends: unix >= 2.5 && < 2.9
78+
build-depends: unix >= 2.8.0.0 && < 2.9
7279
if arch(javascript)
7380
js-sources:
7481
jsbits/process.js
@@ -90,5 +97,10 @@ library
9097

9198
build-depends: base >= 4.10 && < 4.22,
9299
directory >= 1.1 && < 1.4,
93-
filepath >= 1.2 && < 1.6,
94100
deepseq >= 1.1 && < 1.6
101+
102+
if flag(os-string)
103+
build-depends: filepath >= 1.5.0.0 && <1.6,
104+
os-string >= 2.0.0 && <2.1
105+
else
106+
build-depends: filepath >= 1.4.100.0 && < 1.5.0.0

0 commit comments

Comments
 (0)