1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-16 08:13:30 +00:00

Updated escaping rules for agent installer for linux systemd

This commit is contained in:
Bryan Roe
2022-04-26 15:10:32 -07:00
parent a0cd3e3587
commit 3a79731fed
4 changed files with 107 additions and 39 deletions

View File

@@ -56,6 +56,17 @@ function hasBinary(bin)
child.waitExit();
return (child.stdout.str.trim() != '');
}
function findBinary(bin)
{
if (process.platform != 'linux' && process.platform != 'freebsd') { return (null); }
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = '';
child.stdout.on('data', function (c) { this.str += c.toString(); });
child.stdin.write("whereis " + bin + " | awk '{ print $2 }'\nexit\n");
child.waitExit();
return (child.stdout.str.trim()!=""?child.stdout.str.trim():null);
}
module.exports = find;
module.exports.hasBinary = hasBinary;
module.exports.findBinary = findBinary;