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

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);