1
0
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:
Bryan Roe
2021-01-28 17:49:36 -08:00
parent d664208b21
commit acad58b731
2 changed files with 7 additions and 20 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1505,6 +1505,7 @@ function serviceManager()
ret.isMe.platform = platform; ret.isMe.platform = platform;
ret.isRunning = function isRunning() ret.isRunning = function isRunning()
{ {
if (this.OpenRC) { return (!isNaN(this.pid())); }
var child = require('child_process').execFile('/bin/sh', ['sh']); var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.str = '';
child.stdout.on('data', function (chunk) { this.str += chunk.toString(); }); child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
@@ -1514,24 +1515,10 @@ function serviceManager()
} }
else else
{ {
if (this.OpenRC) child.stdin.write("service " + this.name + " status | awk '{print $2}' | awk -F, '{print $1}'\nexit\n");
{
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(); child.waitExit();
if (this.OpenRC) return (child.stdout.str.trim() == 'start/running');
{
return (child.stdout.str.trim() != '');
}
else
{
return (child.stdout.str.trim() == 'start/running');
}
}; };
ret.isRunning.platform = platform; ret.isRunning.platform = platform;
ret.start = function start() ret.start = function start()