sudo: add explicit captureStdout flag
This commit is contained in:
+2
-2
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user