Skip to content

Commit 946e0ab

Browse files
committed
update some
1 parent 53e771b commit 946e0ab

3 files changed

Lines changed: 23 additions & 5 deletions

File tree

src/process/src/Process.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<?php declare(strict_types=1);
22

3-
43
namespace Swoft\Process;
54

6-
75
use Swoft\Process\Exception\ProcessException;
86
use Swoole\Coroutine\Socket;
97
use Swoole\Process as SwooleProcess;
@@ -308,7 +306,6 @@ public static function setAffinity(array $cpuSet): bool
308306
*/
309307
private function getError(): string
310308
{
311-
$errno = swoole_errno();
312-
return swoole_strerror($errno);
309+
return swoole_strerror(swoole_errno());
313310
}
314311
}

src/process/src/ProcessDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function dispatcher(Pool $pool, int $workerId): void
4040
PhpHelper::call([$process, self::METHOD], $pool, $workerId);
4141
} catch (Throwable $e) {
4242
Error::log(sprintf('Run process for process pool fail(%s %s %d)!', $e->getMessage(), $e->getFile(),
43-
$e->getLine()));
43+
$e->getLine()));
4444
}
4545
}
4646

src/process/src/UserProcess.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ abstract class UserProcess implements UserProcessInterface
2626
*/
2727
protected $coroutine = true;
2828

29+
/**
30+
* @var \Swoole\Process
31+
*/
32+
private $swooleProcess;
33+
2934
/**
3035
* @return bool
3136
*/
@@ -49,4 +54,20 @@ public function isCoroutine(): bool
4954
{
5055
return $this->coroutine;
5156
}
57+
58+
/**
59+
* @inheritDoc
60+
*/
61+
public function setSwooleProcess(\Swoole\Process $process): void
62+
{
63+
$this->swooleProcess = $process;
64+
}
65+
66+
/**
67+
* @inheritDoc
68+
*/
69+
public function getSwooleProcess(): \Swoole\Process
70+
{
71+
return $this->swooleProcess;
72+
}
5273
}

0 commit comments

Comments
 (0)