From 3c963329e953e030ca28df383da2a2e50c2b04ba Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 11 Oct 2022 23:14:50 +0200 Subject: [PATCH] du: exclude option --- src/system.js | 7 +++++-- src/test/docker-test.js | 1 - src/test/system-test.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/system.js b/src/system.js index ca83f8f92..2bb6dc493 100644 --- a/src/system.js +++ b/src/system.js @@ -26,8 +26,11 @@ const apps = require('./apps.js'), const DU_CMD = path.join(__dirname, 'scripts/du.sh'); -async function du(file) { - const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ DU_CMD, file ], {})); +async function du(file, options) { + assert.strictEqual(typeof file, 'string'); + assert.strictEqual(typeof options, 'object'); + + const [error, stdoutResult] = await safe(shell.promises.sudo('system', [ DU_CMD, file, options.exclude || '' ], {})); if (error) throw new BoxError(BoxError.FS_ERROR, error); return parseInt(stdoutResult.trim(), 10); diff --git a/src/test/docker-test.js b/src/test/docker-test.js index 5aadc593e..2868a6b75 100644 --- a/src/test/docker-test.js +++ b/src/test/docker-test.js @@ -19,6 +19,5 @@ describe('docker', function () { it('can df', async function () { const output = await docker.df(); expect(output).to.be.ok(); - console.log(output); }); }); diff --git a/src/test/system-test.js b/src/test/system-test.js index 7f6515dff..c7702a2f3 100644 --- a/src/test/system-test.js +++ b/src/test/system-test.js @@ -38,7 +38,7 @@ describe('System', function () { }); it('can get du', async function () { - const usage = await system.du(__dirname); + const usage = await system.du(__dirname, {}); expect(usage).to.be.a('number'); console.log(usage); });