File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -152,3 +152,15 @@ function process_is_running($keyword)
152152 return empty ($ output ) ? false : true ;
153153}
154154
155+ /**
156+ * @param $port
157+ * @return bool
158+ */
159+ function port_is_running ($ port )
160+ {
161+ $ command = "lsof -i: {$ port }" ;
162+
163+ exec ($ command , $ output );
164+
165+ return empty ($ output ) ? false : true ;
166+ }
Original file line number Diff line number Diff line change @@ -544,11 +544,15 @@ public function watch(array $directories = ['.'])
544544 */
545545 public function isRunning ()
546546 {
547- if (file_exists ($ this ->pidFile )) {
548- return process_kill ((int ) file_get_contents ($ this ->pidFile ), 0 );
547+ if (file_exists ($ this ->config ['pid_file ' ])) {
548+ return posix_kill (file_get_contents ($ this ->config ['pid_file ' ]), 0 );
549+ }
550+
551+ if ($ is_running = process_is_running ("{$ this ->name } master " )) {
552+ $ is_running = port_is_running ($ this ->port );
549553 }
550554
551- return process_is_running ( "{ $ this -> name } master " ) ;
555+ return $ is_running ;
552556 }
553557
554558 /**
You can’t perform that action at this time.
0 commit comments