du: exclude option
This commit is contained in:
+5
-2
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user