@@ -651,8 +651,12 @@ public function stop($timeout = 10, $signal = null)
651
651
}
652
652
}
653
653
654
- $ this ->updateStatus (false );
655
- if ($ this ->processInformation ['running ' ]) {
654
+ if ($ this ->isRunning ()) {
655
+ if (isset ($ this ->fallbackStatus ['pid ' ])) {
656
+ unset($ this ->fallbackStatus ['pid ' ]);
657
+
658
+ return $ this ->stop (0 , $ signal );
659
+ }
656
660
$ this ->close ();
657
661
}
658
662
@@ -1145,7 +1149,7 @@ private function resetProcessData()
1145
1149
*/
1146
1150
private function doSignal ($ signal , $ throwException )
1147
1151
{
1148
- if (! $ this ->isRunning ()) {
1152
+ if (null === $ pid = $ this ->getPid ()) {
1149
1153
if ($ throwException ) {
1150
1154
throw new LogicException ('Can not send signal on a non running process. ' );
1151
1155
}
@@ -1154,7 +1158,7 @@ private function doSignal($signal, $throwException)
1154
1158
}
1155
1159
1156
1160
if ('\\' === DIRECTORY_SEPARATOR ) {
1157
- exec (sprintf ('taskkill /F /T /PID %d 2>&1 ' , $ this -> getPid () ), $ output , $ exitCode );
1161
+ exec (sprintf ('taskkill /F /T /PID %d 2>&1 ' , $ pid ), $ output , $ exitCode );
1158
1162
if ($ exitCode && $ this ->isRunning ()) {
1159
1163
if ($ throwException ) {
1160
1164
throw new RuntimeException (sprintf ('Unable to kill the process (%s). ' , implode (' ' , $ output )));
78F0
button>@@ -1166,8 +1170,8 @@ private function doSignal($signal, $throwException)
1166
1170
if (!$ this ->enhanceSigchildCompatibility || !$ this ->isSigchildEnabled ()) {
1167
1171
$ ok = @proc_terminate ($ this ->process , $ signal );
1168
1172
} elseif (function_exists ('posix_kill ' )) {
1169
- $ ok = @posix_kill ($ this -> getPid () , $ signal );
1170
- } elseif ($ ok = proc_open (sprintf ('kill -%d %d ' , $ signal , $ this -> getPid () ), array (2 => array ('pipe ' , 'w ' )), $ pipes )) {
1173
+ $ ok = @posix_kill ($ pid , $ signal );
1174
+ } elseif ($ ok = proc_open (sprintf ('kill -%d %d ' , $ signal , $ pid ), array (2 => array ('pipe ' , 'w ' )), $ pipes )) {
1171
1175
$ ok = false === fgets ($ pipes [2 ]);
1172
1176
}
1173
1177
if (!$ ok ) {
0 commit comments