File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,9 @@ module System.Process.Typed
109
109
, checkExitCode
110
110
, checkExitCodeSTM
111
111
112
+ -- ** Process ID
113
+ , getPid
114
+
112
115
-- ** Process streams
113
116
, getStdin
114
117
, getStdout
@@ -121,6 +124,7 @@ module System.Process.Typed
121
124
-- * Re-exports
122
125
, ExitCode (.. )
123
126
, P. StdStream (.. )
127
+ , P. Pid
124
128
125
129
-- * Unsafe functions
126
130
, unsafeProcessHandle
@@ -641,6 +645,17 @@ checkExitCodeSTM p = do
641
645
, eceStderr = L. empty
642
646
}
643
647
648
+ -- | Returns the PID (process ID) of a subprocess.
649
+ --
650
+ -- 'Nothing' is returned if the underlying 'P.ProcessHandle' was already closed.
651
+ -- Otherwise a PID is returned that remains valid as long as the handle is
652
+ -- open. The operating system may reuse the PID as soon as the last handle to
653
+ -- the process is closed.
654
+ --
655
+ -- @since 0.2.12.0
656
+ getPid :: Process stdin stdout stderr -> IO (Maybe P. Pid )
657
+ getPid = P. getPid . pHandle
658
+
644
659
-- | Internal
645
660
clearStreams :: ProcessConfig stdin stdout stderr -> ProcessConfig () () ()
646
661
clearStreams pc = pc
You can’t perform that action at this time.
0 commit comments