mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-17 16:53:13 +00:00
Added work-around if linux-dbus isn't updated
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -221,3 +221,15 @@ function Toaster()
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = new Toaster();
|
module.exports = new Toaster();
|
||||||
|
if (process.platform == 'linux' && !require('linux-dbus').hasService)
|
||||||
|
{
|
||||||
|
require('linux-dbus').hasService = function hasService(name)
|
||||||
|
{
|
||||||
|
var child = require('child_process').execFile('/bin/sh', ['sh']);
|
||||||
|
child.stderr.str = ''; child.stderr.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
|
||||||
|
child.stdin.write('cat /usr/share/dbus-1/services/*.service | grep "' + name + '" | awk -F= \'{ if( $2=="' + name + '" ) { print $2; } }\'\nexit\n');
|
||||||
|
child.waitExit();
|
||||||
|
return (child.stdout.str.trim() != '');
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user