process 1.6.16.0 → 1.6.17.0
raw patch · 9 files changed
+77/−4 lines, 9 filesdep ~base
Dependency ranges changed: base
Files
- System/Process.hs +21/−0
- System/Process/Common.hs +4/−1
- System/Process/Posix.hs +30/−0
- cbits/posix/fork_exec.c +4/−0
- cbits/posix/posix_spawn.c +3/−0
- cbits/posix/runProcess.c +4/−0
- changelog.md +4/−0
- include/runProcess.h +5/−1
- process.cabal +2/−2
System/Process.hs view
@@ -6,6 +6,8 @@ #endif {-# LANGUAGE InterruptibleFFI #-} +#include <ghcplatform.h>+ ----------------------------------------------------------------------------- -- | -- Module : System.Process@@ -102,6 +104,11 @@ import GHC.IO.Exception ( ioException, IOErrorType(..), IOException(..) ) +#if defined(wasm32_HOST_ARCH)+import GHC.IO.Exception ( unsupportedOperation )+import System.IO.Error+#endif+ -- | The platform specific type for a process identifier. -- -- This is always an integral type. Width and signedness are platform specific.@@ -857,6 +864,19 @@ -- ---------------------------------------------------------------------------- -- Interface to C bits +#if defined(wasm32_HOST_ARCH)++c_terminateProcess :: PHANDLE -> IO CInt+c_terminateProcess _ = ioError (ioeSetLocation unsupportedOperation "terminateProcess")++c_getProcessExitCode :: PHANDLE -> Ptr CInt -> IO CInt+c_getProcessExitCode _ _ = ioError (ioeSetLocation unsupportedOperation "getProcessExitCode")++c_waitForProcess :: PHANDLE -> Ptr CInt -> IO CInt+c_waitForProcess _ _ = ioError (ioeSetLocation unsupportedOperation "waitForProcess")++#else+ foreign import ccall unsafe "terminateProcess" c_terminateProcess :: PHANDLE@@ -874,6 +894,7 @@ -> Ptr CInt -> IO CInt +#endif -- ---------------------------------------------------------------------------- -- Old deprecated variants
System/Process/Common.hs view
@@ -88,7 +88,7 @@ std_in :: StdStream, -- ^ How to determine stdin std_out :: StdStream, -- ^ How to determine stdout std_err :: StdStream, -- ^ How to determine stderr- close_fds :: Bool, -- ^ Close all file descriptors except stdin, stdout and stderr in the new process (on Windows, only works if std_in, std_out, and std_err are all Inherit). This implementation will call close an every fd from 3 to the maximum of open files, which can be slow for high maximum of open files.+ close_fds :: Bool, -- ^ Close all file descriptors except stdin, stdout and stderr in the new process (on Windows, only works if std_in, std_out, and std_err are all Inherit). This implementation will call close on every fd from 3 to the maximum of open files, which can be slow for high maximum of open files. create_group :: Bool, -- ^ Create a new process group delegate_ctlc:: Bool, -- ^ Delegate control-C handling. Use this for interactive console processes to let them handle control-C themselves (see below for details). --@@ -190,6 +190,9 @@ -- ProcessHandle type data ProcessHandle__ = OpenHandle { phdlProcessHandle :: PHANDLE }+ -- | 'OpenExtHandle' is only applicable for+ -- Windows platform. It represents [Job+ -- Objects](https://learn.microsoft.com/en-us/windows/win32/procthread/job-objects). | OpenExtHandle { phdlProcessHandle :: PHANDLE -- ^ the process , phdlJobHandle :: PHANDLE
System/Process/Posix.hs view
@@ -1,5 +1,8 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-}++#include <ghcplatform.h>+ module System.Process.Posix ( mkProcessHandle , translateInternal@@ -43,6 +46,10 @@ import System.Process.Common hiding (mb_delegate_ctlc) +#if defined(wasm32_HOST_ARCH)+import System.IO.Error+#endif+ #include "HsProcessConfig.h" #include "processFlags.h" @@ -262,6 +269,27 @@ where sig = fromIntegral (-n) +#if defined(wasm32_HOST_ARCH)++c_runInteractiveProcess+ :: Ptr CString+ -> CString+ -> Ptr CString+ -> FD+ -> FD+ -> FD+ -> Ptr FD+ -> Ptr FD+ -> Ptr FD+ -> Ptr CGid+ -> Ptr CUid+ -> CInt -- flags+ -> Ptr CString+ -> IO PHANDLE+c_runInteractiveProcess _ _ _ _ _ _ _ _ _ _ _ _ _ = ioError (ioeSetLocation unsupportedOperation "runInteractiveProcess")++#else+ foreign import ccall unsafe "runInteractiveProcess" c_runInteractiveProcess :: Ptr CString@@ -278,6 +306,8 @@ -> CInt -- flags -> Ptr CString -> IO PHANDLE++#endif ignoreSignal, defaultSignal :: CLong ignoreSignal = CONST_SIG_IGN
cbits/posix/fork_exec.c view
@@ -3,6 +3,8 @@ #include "common.h" +#if defined(HAVE_FORK)+ #include <sys/types.h> #include <sys/wait.h> #include <errno.h>@@ -327,3 +329,5 @@ return pid; }++#endif // HAVE_FORK
cbits/posix/posix_spawn.c view
@@ -3,8 +3,11 @@ #include <unistd.h> #include <errno.h>++#if defined(HAVE_SIGNAL_H) #include <signal.h> #include <fcntl.h>+#endif #if !defined(USE_POSIX_SPAWN) ProcHandle
cbits/posix/runProcess.c view
@@ -7,6 +7,8 @@ #include "runProcess.h" #include "common.h" +#if defined(HAVE_FORK)+ #include <unistd.h> #include <errno.h> #include <sys/wait.h>@@ -265,3 +267,5 @@ return -1; }++#endif // HAVE_FORK
changelog.md view
@@ -1,5 +1,9 @@ # Changelog for [`process` package](http://hackage.haskell.org/package/process) +## 1.6.17.0 *February 2023*++* Improved documentation for the `OpenExtHandle` constructor.+ ## 1.6.16.0 *October 2022* * `posix_spawn`: Don't rely on addclose not failing for closed fds [#251](https://github.com/haskell/process/issues/251)
include/runProcess.h view
@@ -31,7 +31,11 @@ #include "processFlags.h" -#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32))+#include <ghcplatform.h>++#if defined(wasm32_HOST_ARCH)++#elif !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)) #include <pwd.h> #include <grp.h>
process.cabal view
@@ -1,5 +1,5 @@ name: process-version: 1.6.16.0+version: 1.6.17.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE@@ -81,7 +81,7 @@ ghc-options: -Wall - build-depends: base >= 4.10 && < 4.18,+ build-depends: base >= 4.10 && < 4.19, directory >= 1.1 && < 1.4, filepath >= 1.2 && < 1.5, deepseq >= 1.1 && < 1.5