sudo: add explicit captureStdout flag

This commit is contained in:
Girish Ramakrishnan
2024-07-08 09:58:25 +02:00
parent 7d8ba8d42c
commit 60c4dd3875
3 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ const REBOOT_CMD = path.join(__dirname, 'scripts/reboot.sh');
async function du(file) {
assert.strictEqual(typeof file, 'string');
const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ DU_CMD, file ], {}));
const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ DU_CMD, file ], { captureStdout: true }));
if (error) throw new BoxError(BoxError.FS_ERROR, error);
return parseInt(stdoutResult.trim(), 10);
@@ -53,7 +53,7 @@ async function du(file) {
async function hdparm(file) {
assert.strictEqual(typeof file, 'string');
const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ HDPARM_CMD, file ], {}));
const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ HDPARM_CMD, file ], { captureStdout: true }));
if (error) throw new BoxError(BoxError.FS_ERROR, error);
const lines = stdoutResult.split('\n');