Skip to content

Commit 48251d6

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

File tree

4 files changed

+86
-3
lines changed

4 files changed

+86
-3
lines changed

System/Process/Env.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-----------------------------------------------------------------------------
2+
-- |
3+
-- Module : System.Process.Env
4+
-- Copyright : (c) The University of Glasgow 2004-2008
5+
-- License : BSD-style (see the file libraries/base/LICENSE)
6+
--
7+
-- Maintainer : libraries@haskell.org
8+
-- Stability : experimental
9+
-- Portability : non-portable (requires concurrency)
10+
--
11+
-- Miscellaneous information about the system environment.
12+
--
13+
-- @since X.Y.Z
14+
--
15+
-----------------------------------------------------------------------------
16+
17+
module System.Process.Env (
18+
Env.getArgs
19+
) where
20+
21+
import qualified System.Environment as Env

System/Process/Env/OsString.hs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
-----------------------------------------------------------------------------
11+
-- |
12+
-- Module : System.Process.Env.OsString
13+
-- Copyright : (c) The University of Glasgow 2004-2008
14+
-- License : BSD-style (see the file libraries/base/LICENSE)
15+
--
16+
-- Maintainer : libraries@haskell.org
17+
-- Stability : experimental
18+
-- Portability : non-portable (requires concurrency)
19+
--
20+
-- Miscellaneous information about the system environment.
21+
--
22+
-- @since X.Y.Z
23+
--
24+
-----------------------------------------------------------------------------
25+
26+
module System.Process.Env.OsString (
27+
getArgs
28+
) where
29+
30+
import Data.Coerce (coerce)
31+
#if defined(mingw32_HOST_OS)
32+
import qualified System.Win32.WindowsString.Console as Platform
33+
import System.OsString.Internal.Types
34+
( OsString(OsString), WindowsString(WindowsString) )
35+
#else
36+
import System.OsString.Internal.Types
37+
( OsString(OsString), PosixString(PosixString) )
38+
import qualified System.Posix.Env.PosixString as Platform
39+
#endif
40+
41+
-- | 'System.Environment.getArgs' for 'OsString'.
42+
--
43+
-- @since X.Y.Z
44+
getArgs :: IO [OsString]
45+
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)