@@ -229,8 +229,8 @@ public function work($interval = Resque::DEFAULT_INTERVAL, $blocking = false)
229
229
230
230
$ this ->child = Resque::fork ();
231
231
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 ) {
234
234
$ status = 'Processing ' . $ job ->queue . ' since ' . strftime ('%F %T ' );
235
235
$ this ->updateProcLine ($ status );
236
236
$ this ->logger ->log (Psr \Log \LogLevel::INFO , $ status );
@@ -529,9 +529,18 @@ public function pruneDeadWorkers()
529
529
public function workerPids ()
530
530
{
531
531
$ 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
+ }
535
544
}
536
545
return $ pids ;
537
546
}
0 commit comments