Skip to content

Commit 6a277ba

Browse files
committed
update some info
1 parent 8edf49c commit 6a277ba

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/ProcessUtil.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public static function sendSignal(int $pid, int $signal, int $timeout = 0): bool
388388

389389
// try again kill
390390
$ret = \posix_kill($pid, $signal);
391-
usleep(10000);
391+
\usleep(10000);
392392
}
393393

394394
return $ret;
@@ -558,12 +558,18 @@ public static function setName(string $title): bool
558558
*/
559559
public static function setTitle(string $title): bool
560560
{
561-
if (Sys::isMac()) {
561+
if (!$title || 'Darwin' === \PHP_OS) {
562562
return false;
563563
}
564564

565565
if (\function_exists('cli_set_process_title')) {
566-
return \cli_set_process_title($title);
566+
\cli_set_process_title($title);
567+
} elseif (\function_exists('setproctitle')) {
568+
\setproctitle($title);
569+
}
570+
571+
if ($error = \error_get_last()) {
572+
throw new \RuntimeException($error['message']);
567573
}
568574

569575
return false;
@@ -587,7 +593,7 @@ public static function changeScriptOwner(string $user, string $group = '')
587593

588594
// Get gid.
589595
if ($group) {
590-
if (!$gInfo = posix_getgrnam($group)) {
596+
if (!$gInfo = \posix_getgrnam($group)) {
591597
throw new \RuntimeException("Group {$group} not exists", -300);
592598
}
593599

src/Signal.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @package Toolkit\Sys
1414
* @link http://php.net/manual/en/pcntl.constants.php
1515
*/
16-
class Signal
16+
final class Signal
1717
{
1818
public const IGN = 1;
1919
public const DFL = 0;

src/Sys.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static function run(string $command, string $cwd = null): array
9595
* @param string|null $cwd
9696
* @return array|string
9797
*/
98-
public static function execute($command, bool $returnStatus = true, string $cwd = null)
98+
public static function execute(string $command, bool $returnStatus = true, string $cwd = null)
9999
{
100100
$exitStatus = 1;
101101

0 commit comments

Comments
 (0)