@@ -229,8 +229,8 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
229229
230230 $ this ->child = Resque::fork ();
231231
232- // Forked and we're the child. Run the job.
233- if ($ this ->child === 0 || $ this ->child === false ) {
232+ // Forked and we're the child. Or PCNTL is not installed. Run the job.
233+ if ($ this ->child === 0 || $ this ->child === false || $ this -> child === - 1 ) {
234234 $ status = 'Processing ' . $ job ->queue . ' since ' . strftime ('%F %T ' );
235235 $ this ->updateProcLine ($ status );
236236 $ this ->logger ->log (Psr \Log \LogLevel::INFO , $ status );
@@ -529,9 +529,18 @@ public function pruneDeadWorkers()
529529 public function workerPids ()
530530 {
531531 $ pids = array ();
532- exec ('ps -A -o pid,args | grep [r]esque ' , $ cmdOutput );
533- foreach ($ cmdOutput as $ line ) {
534- list ($ pids [],) = explode (' ' , trim ($ line ), 2 );
532+ if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
533+ exec ('WMIC path win32_process get Processid,Commandline | findstr resque | findstr /V findstr ' , $ cmdOutput );
534+ foreach ($ cmdOutput as $ line ) {
535+ $ line = preg_replace ('/\s+/m ' , ' ' , $ line );
536+ list (,,$ pids []) = explode (' ' , trim ($ line ), 3 );
537+ }
538+ }
539+ else {
540+ exec ('ps -A -o pid,args | grep [r]esque ' , $ cmdOutput );
541+ foreach ($ cmdOutput as $ line ) {
542+ list ($ pids [],) = explode (' ' , trim ($ line ), 2 );
543+ }
535544 }
536545 return $ pids ;
537546 }
0 commit comments