From 83fdcbc4b9fc941629d99709c27f19e1e4dc8897 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Fri, 21 Jun 2019 17:35:57 -0700 Subject: [PATCH] freebsd update --- modules/service-manager.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/service-manager.js b/modules/service-manager.js index a34abcb..30456aa 100644 --- a/modules/service-manager.js +++ b/modules/service-manager.js @@ -729,17 +729,16 @@ function serviceManager() ret.appLocation = function appLocation() { 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("cat " + this.rc + " grep command= | awk -F= '{ print $2 }' | awk -F\\\" '{ print $2 }'\\nexit\\n"); + child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); }); + child.stdin.write("cat " + this.rc + " | grep command= | awk -F= '{ print $2 }' | awk -F\\\" '{ print $2 }'\nexit\n"); child.waitExit(); - - return (child.stdout.str.trim().replace('{name}', this.name)); + return (child.stdout.str.trim().split('${name}').join(this.name)); }; ret.isRunning = function isRunning() { 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("service " + this.name + " onestatus | awk '{ print $3 }'\\nexit\\n"); + child.stdin.write("service " + this.name + " onestatus | awk '{ print $3 }'\nexit\n"); child.waitExit(); return (child.stdout.str.trim() == 'running'); }; @@ -747,7 +746,7 @@ function serviceManager() { 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("service " + this.name + " onestatus | awk '{ split($6, res, \".\"); print res[1]; }'\\nexit\\n"); + child.stdin.write("service " + this.name + " onestatus | awk '{ split($6, res, \".\"); print res[1]; }'\nexit\n"); child.waitExit(); return (parseInt(child.stdout.str.trim()) == process.pid); }; @@ -1584,4 +1583,4 @@ module.exports.manager = new serviceManager(); if (process.platform == 'darwin') { module.exports.getOSVersion = getOSVersion; -} \ No newline at end of file +}