Skip to content

Commit 7fb4176

Browse files
committed
isrunning works
1 parent 3bc2bfe commit 7fb4176

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/Local.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010

1111
class Local {
1212

13-
private $handle = NULL;
14-
private $pipes = array();
15-
private $loghandle = NULL;
1613
public $pid = NULL;
1714

1815
public function __construct() {
@@ -25,7 +22,8 @@ public function __destruct() {
2522
}
2623

2724
public function isRunning() {
28-
25+
if ($this->pid == NULL)
26+
return False;
2927
if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
3028
{
3129
$processes = explode( "\n", shell_exec( "tasklist.exe" ));
@@ -40,7 +38,11 @@ public function isRunning() {
4038

4139
}
4240
else {
43-
return file_exists( "/proc/$this->pid" );
41+
$return_message = shell_exec("ps -" . "$this->pid " . "| wc -l");
42+
if (intval($return_message) > 1)
43+
{
44+
return True;
45+
}
4446
}
4547
}
4648

@@ -109,7 +111,6 @@ public function start($arguments) {
109111
}
110112

111113
public function stop() {
112-
fclose($this->loghandle);
113114
$call = $this->stop_command();
114115
shell_exec("$call");
115116
}

0 commit comments

Comments
 (0)