@@ -651,8 +651,12 @@ public function stop($timeout = 10, $signal = null)
651651 }
652652 }
653653
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+ }
656660 $ this ->close ();
657661 }
658662
@@ -1145,7 +1149,7 @@ private function resetProcessData()
11451149 */
11461150 private function doSignal ($ signal , $ throwException )
11471151 {
1148- if (! $ this ->isRunning ()) {
1152+ if (null === $ pid = $ this ->getPid ()) {
11491153 if ($ throwException ) {
11501154 throw new LogicException ('Can not send signal on a non running process. ' );
11511155 }
@@ -1154,7 +1158,7 @@ private function doSignal($signal, $throwException)
11541158 }
11551159
11561160 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 );
11581162 if ($ exitCode && $ this ->isRunning ()) {
11591163 if ($ throwException ) {
11601164 throw new RuntimeException (sprintf ('Unable to kill the process (%s). ' , implode (' ' , $ output )));
@@ -1166,8 +1170,8 @@ private function doSignal($signal, $throwException)
11661170 if (!$ this ->enhanceSigchildCompatibility || !$ this ->isSigchildEnabled ()) {
11671171 $ ok = @proc_terminate ($ this ->process , $ signal );
11681172 } 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 )) {
11711175 $ ok = false === fgets ($ pipes [2 ]);
11721176 }
11731177 if (!$ ok ) {
0 commit comments