We now use systemd-run no need for sudoDetached

This commit is contained in:
Johannes
2016-11-01 18:17:16 +01:00
parent 18b58ced8d
commit 15f7ada958
2 changed files with 2 additions and 35 deletions

View File

@@ -3,8 +3,7 @@
exports = module.exports = {
exec: exec,
execSync: execSync,
sudo: sudo,
sudoDetached: sudoDetached
sudo: sudo
};
var assert = require('assert'),
@@ -71,35 +70,3 @@ function sudo(tag, args, callback) {
var cp = exec(tag, SUDO, [ '-S' ].concat(args), callback);
cp.stdin.end();
}
function sudoDetached(tag, args, callback) {
assert.strictEqual(typeof tag, 'string');
assert(util.isArray(args));
assert.strictEqual(typeof callback, 'function');
callback = once(callback); // exit may or may not be called after an 'error'
debug(tag + ' sudoDetached: %s %s', SUDO, args.join(' '));
var cp = child_process.spawn(SUDO, [ '-S' ].concat(args), { detached: true });
cp.stdout.on('data', function (data) {
debug(tag + ' (stdout): %s', data.toString('utf8'));
});
cp.stderr.on('data', function (data) {
debug(tag + ' (stderr): %s', data.toString('utf8'));
});
cp.on('exit', function (code, signal) {
if (code || signal) debug(tag + ' code: %s, signal: %s', code, signal);
callback(code === 0 ? null : new Error(util.format(tag + ' exited with error %s signal %s', code, signal)));
});
cp.on('error', function (error) {
debug(tag + ' code: %s, signal: %s', error.code, error.signal);
callback(error);
});
return cp;
}