shell: merge some options
This commit is contained in:
+2
-1
@@ -164,7 +164,8 @@ async function runBackupUpload(uploadConfig, progressCallback) {
|
||||
result = progress.result;
|
||||
}
|
||||
|
||||
const [error] = await safe(shell.promises.sudo([ BACKUP_UPLOAD_CMD, remotePath, backupConfig.format, dataLayout.toString() ], { env: envCopy, preserveEnv: true, ipc: true, onMessage, outputHasTimestamps: true }));
|
||||
// do not use debug for logging child output because it already has timestamps via it's own debug
|
||||
const [error] = await safe(shell.promises.sudo([ BACKUP_UPLOAD_CMD, remotePath, backupConfig.format, dataLayout.toString() ], { env: envCopy, preserveEnv: true, onMessage, logger: process.stdout.write }));
|
||||
if (error && (error.code === null /* signal */ || (error.code !== 0 && error.code !== 50))) { // backuptask crashed
|
||||
debug(`runBackupUpload: backuptask crashed`, error);
|
||||
throw new BoxError(BoxError.INTERNAL_ERROR, 'Backuptask crashed');
|
||||
|
||||
+2
-2
@@ -113,9 +113,9 @@ function sudo(tag, args, options, callback) {
|
||||
|
||||
callback = once(callback); // exit may or may not be called after an 'error'
|
||||
|
||||
const logFunc = options.outputHasTimestamps ? process.stdout.write : debug;
|
||||
const logFunc = options.logger || debug;
|
||||
|
||||
if (options.ipc) {
|
||||
if (options.onMessage) { // enable ipc
|
||||
sudoArgs.push('--close-from=4'); // keep the ipc open. requires closefrom_override in sudoers file
|
||||
options.stdio = ['pipe', 'pipe', 'pipe', 'ipc'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user