shell: merge some options

This commit is contained in:
Girish Ramakrishnan
2025-07-16 21:32:27 +02:00
parent e03beba9bc
commit 50b585c1dd
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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
View File
@@ -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'];
}