Skip to content

Commit bbf9b0e

Browse files
authored
Merge pull request #211 from garas/pid-is-not-int
Do not typecast PID to int
2 parents 43b274b + c2a76de commit bbf9b0e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/Model/Table/QueuedJobsTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ public function getProcesses($forThisServer = false) {
794794
/**
795795
* Soft ending of a running job, e.g. when migration is starting
796796
*
797-
* @param int $pid
797+
* @param string $pid
798798
* @return void
799799
*/
800800
public function endProcess($pid) {

src/Shell/QueueShell.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,15 @@ public function end($in = null) {
289289

290290
if ($in === 'all' || $in === 'server') {
291291
foreach ($processes as $process => $timestamp) {
292-
$this->QueuedJobs->endProcess((int)$process);
292+
$this->QueuedJobs->endProcess($process);
293293
}
294294

295295
$this->out('All ' . count($processes) . ' processes ended.');
296296

297297
return;
298298
}
299299

300-
$this->QueuedJobs->endProcess((int)$in);
300+
$this->QueuedJobs->endProcess($in);
301301
}
302302

303303
/**
@@ -603,8 +603,9 @@ protected function _initPid() {
603603
* @return string
604604
*/
605605
protected function _retrievePid() {
606-
$pid = (string)getmypid();
607-
if (!$pid) {
606+
if (function_exists('posix_getpid')) {
607+
$pid = (string)posix_getpid();
608+
} else {
608609
$pid = $this->QueuedJobs->key();
609610
}
610611

0 commit comments

Comments
 (0)