@@ -42,11 +42,19 @@ public function __construct(string $command, string $cwd = null, string $input =
42
42
43
43
private function getDescriptors ()
44
44
{
45
- return array (
46
- self ::STDIN_DESCRIPTOR_KEY => array ("pipe " , "r " ),
47
- self ::STDOUT_DESCRIPTOR_KEY => array ("pipe " , "w " ),
48
- self ::STDERR_DESCRIPTOR_KEY => array ("pipe " , "r " )
49
- );
45
+ if ('\\' === \DIRECTORY_SEPARATOR ) {
46
+ return array (
47
+ self ::STDIN_DESCRIPTOR_KEY => array ('pipe ' , 'r ' ),
48
+ self ::STDOUT_DESCRIPTOR_KEY => array ('file ' , 'NUL ' , 'w ' ),
49
+ self ::STDERR_DESCRIPTOR_KEY => array ('file ' , 'NUL ' , 'w ' ),
50
+ );
51
+ } else {
52
+ return array (
53
+ self ::STDIN_DESCRIPTOR_KEY => array ('pipe ' , 'r ' ),
54
+ self ::STDOUT_DESCRIPTOR_KEY => array ('pipe ' , 'w ' ),
55
+ self ::STDERR_DESCRIPTOR_KEY => array ('pipe ' , 'w ' ),
56
+ );
57
+ }
50
58
}
51
59
52
60
private function setInput ()
@@ -132,6 +140,11 @@ public function isRunning()
132
140
return $ this ->status && $ this ->status ['running ' ];
133
141
}
134
142
143
+ public function getProcessId ()
144
+ {
145
+ return $ this ->isRunning () ? $ this ->status ['pid ' ] : null ;
146
+ }
147
+
135
148
public function stop ()
136
149
{
137
150
if (!$ this ->isRunning ()) {
0 commit comments