From 15f7ada958e8d32b6f2b62599f6eb63cf99b6167 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 1 Nov 2016 18:17:16 +0100 Subject: [PATCH] We now use systemd-run no need for sudoDetached --- src/cloudron.js | 2 +- src/shell.js | 35 +---------------------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/cloudron.js b/src/cloudron.js index 32234ae4f..29b96cb04 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -608,7 +608,7 @@ function doUpdate(boxUpdateInfo, callback) { debug('updating box %s %j', boxUpdateInfo.sourceTarballUrl, data); - shell.sudoDetached('update', [ UPDATE_CMD, boxUpdateInfo.sourceTarballUrl, JSON.stringify(data) ], function (error) { + shell.sudo('update', [ UPDATE_CMD, boxUpdateInfo.sourceTarballUrl, JSON.stringify(data) ], function (error) { if (error) return updateError(error); // Do not add any code here. The installer script will stop the box code any instant diff --git a/src/shell.js b/src/shell.js index a9d18cd68..934dd81d4 100644 --- a/src/shell.js +++ b/src/shell.js @@ -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; -}