test: only suppress starttask.sh output and not sudo

the remote support logic uses sudo output in tests
This commit is contained in:
Girish Ramakrishnan
2023-07-13 09:08:06 +05:30
parent 13a8926f60
commit 7926ff2811
2 changed files with 5 additions and 4 deletions
+5 -1
View File
@@ -45,8 +45,10 @@ exports = module.exports = {
const assert = require('assert'),
BoxError = require('./boxerror.js'),
constants = require('./constants.js'),
database = require('./database.js'),
debug = require('debug')('box:tasks'),
fs = require('fs'),
logs = require('./logs.js'),
path = require('path'),
paths = require('./paths.js'),
@@ -167,7 +169,9 @@ function startTask(id, options, callback) {
let killTimerId = null, timedOut = false;
gTasks[id] = shell.sudo('startTask', [ START_TASK_CMD, id, logFile, options.nice || 0, options.memoryLimit || 400 ], { preserveEnv: true }, async function (sudoError) {
const sudoOptions = { preserveEnv: true, logStream: null };
if (constants.TEST) sudoOptions.logStream = fs.createWriteStream('/dev/null'); // without this output is messed up, not sure why
gTasks[id] = shell.sudo('startTask', [ START_TASK_CMD, id, logFile, options.nice || 0, options.memoryLimit || 400 ], sudoOptions, async function (sudoError) {
if (!gTasks[id]) return; // ignore task exit since we are shutting down. see stopAllTasks
const code = sudoError ? sudoError.code : 0;