mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-20 10:13:17 +00:00
Added workaround for rc-status bug
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1505,6 +1505,7 @@ function serviceManager()
|
||||
ret.isMe.platform = platform;
|
||||
ret.isRunning = function isRunning()
|
||||
{
|
||||
if (this.OpenRC) { return (!isNaN(this.pid())); }
|
||||
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||
child.stdout.str = '';
|
||||
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
|
||||
@@ -1513,25 +1514,11 @@ function serviceManager()
|
||||
child.stdin.write("initctl status " + this.name + " | awk '{print $2}' | awk -F, '{print $1}'\nexit\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.OpenRC)
|
||||
{
|
||||
child.stdin.write('rc-status | grep "\\s*' + this.name + ' "\nexit\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
child.stdin.write("service " + this.name + " status | awk '{print $2}' | awk -F, '{print $1}'\nexit\n");
|
||||
}
|
||||
}
|
||||
child.waitExit();
|
||||
if (this.OpenRC)
|
||||
{
|
||||
return (child.stdout.str.trim() != '');
|
||||
}
|
||||
else
|
||||
{
|
||||
return (child.stdout.str.trim() == 'start/running');
|
||||
}
|
||||
};
|
||||
ret.isRunning.platform = platform;
|
||||
ret.start = function start()
|
||||
|
||||
Reference in New Issue
Block a user