Skip to content

Commit 39b1b4d

Browse files
committed
fixed runtime status
1 parent 49db592 commit 39b1b4d

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

helpers.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,16 @@ 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} | grep LISTEN";
162+
163+
exec($command, $output);
164+
165+
return !empty($output);
166+
}
167+

src/Server.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,8 @@ public function isRunning()
519519
if (file_exists($this->config['pid_file'])) {
520520
return posix_kill(file_get_contents($this->config['pid_file']), 0);
521521
}
522-
return process_is_running("{$this->name} master");
522+
523+
return process_is_running("{$this->name} master") && port_is_running($this->port);
523524
}
524525

525526
/**

0 commit comments

Comments
 (0)