du: exclude option

This commit is contained in:
Girish Ramakrishnan
2022-10-11 23:14:50 +02:00
parent 656f3fcc13
commit 3c963329e9
3 changed files with 6 additions and 4 deletions
+5 -2
View File
@@ -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);
-1
View File
@@ -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);
});
});
+1 -1
View File
@@ -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);
});