File tree Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Expand file tree Collapse file tree 1 file changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -56,19 +56,17 @@ public function handle()
56
56
}elseif ($ option_port ){
57
57
// kill process by port, cannot be used in wsl
58
58
$ servers = config ('server.servers ' );
59
- foreach ($ servers as $ server ){
60
- $ port = $ server ['port ' ];
61
- $ result = System::exec ("lsof -i: " .$ port ."|awk '{if (NR>1){print $2}}' " ); // |xargs kill -9
62
- $ pids = trim ($ result ['output ' ]);
63
- if (empty ($ pids )){
64
- stdLog ()->warning ('server not found ' );
65
- return ;
66
- }
67
- $ pids = explode (PHP_EOL , $ pids );
68
- $ pids = implode (' ' , $ pids );
69
- System::exec ("kill -9 $ pids " );
70
- stdLog ()->info ("force stop server success by port ` $ port` " );
59
+ $ port = $ servers [0 ]['port ' ];
60
+ $ result = System::exec ("lsof -i: " .$ port ."|awk '{if (NR>1){print $2}}' " ); // |xargs kill -9
61
+ $ pids = trim ($ result ['output ' ]);
62
+ if (empty ($ pids )){
63
+ stdLog ()->warning ('server not found ' );
64
+ return ;
71
65
}
66
+ $ pids = explode (PHP_EOL , $ pids );
67
+ $ pids = implode (' ' , $ pids );
68
+ System::exec ("kill -9 $ pids " );
69
+ stdLog ()->info ("force stop server success by port ` $ port` " );
72
70
} else {
73
71
// default kill process by hyperf.pid
74
72
$ master_pid = getMasterPid ();
You can’t perform that action at this time.
0 commit comments