Skip to content

Commit bfebfcb

Browse files
committed
update
1 parent 049ca76 commit bfebfcb

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/ConfigProvider.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,7 @@ class ConfigProvider
1313
{
1414
public function __invoke(): array
1515
{
16-
$option_daemonize = env('DAEMONIZE', false);
17-
if ($option_daemonize) {
18-
$log_file = BASE_PATH . '/runtime/logs/';
19-
if (!file_exists($log_file)) {
20-
mkdir($log_file);
21-
}
22-
$log_file .= 'hyperf.out.log';
23-
} else {
24-
$log_file = '';
25-
}
26-
return [
16+
$config = [
2717
'commands' => [
2818
ServerStartCommand::class,
2919
ServerStopCommand::class,
@@ -33,10 +23,6 @@ public function __invoke(): array
3323
],
3424
'server' => [
3525
'settings' => [
36-
Constant::OPTION_DAEMONIZE => $option_daemonize,
37-
Constant::OPTION_LOG_FILE => $log_file,
38-
// Constant::OPTION_RELOAD_ASYNC => true, // 设置异步重启开关 swoole default
39-
// Constant::OPTION_MAX_WAIT_TIME => 3, // 设置 Worker 进程收到停止服务通知后最大等待时间 swoole default
4026
],
4127
],
4228
'publish' => [
@@ -54,5 +40,19 @@ public function __invoke(): array
5440
],
5541
],
5642
];
43+
44+
$option_daemonize = env('DAEMONIZE', false);
45+
if ($option_daemonize) {
46+
$log_file = BASE_PATH . '/runtime/logs/';
47+
if (!file_exists($log_file)) {
48+
mkdir($log_file);
49+
}
50+
$log_file .= 'hyperf.out.log';
51+
$config['server']['settings'][Constant::OPTION_DAEMONIZE] = true;
52+
$config['server']['settings'][Constant::OPTION_LOG_FILE] = $log_file;
53+
// $config['server']['settings'][Constant::OPTION_RELOAD_ASYNC] = true; // 设置异步重启开关 swoole default
54+
// $config['server']['settings'][Constant::OPTION_MAX_WAIT_TIME] = 3; // 设置 Worker 进程收到停止服务通知后最大等待时间 swoole default
55+
}
56+
return $config;
5757
}
5858
}

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function getPhpPath(): string
284284
$pid = posix_getpid();
285285
if(PHP_OS == 'Darwin'){
286286
// macOS
287-
$result = System::exec("ps -e|grep $pid|grep -v grep|awk '{print $(NF-2)}'");
287+
$result = System::exec("ps -e|grep $pid|grep -v grep|awk '{print $4}'");
288288
}else{
289289
// CentOS/Ubuntu
290290
$result = System::exec("ls -l /proc/{$pid}|grep exe|awk '{print $(NF)}'");

0 commit comments

Comments
 (0)