df: check if path exists
This commit is contained in:
@@ -54,6 +54,8 @@ async function filesystems() {
|
||||
async function file(filename) {
|
||||
assert.strictEqual(typeof filename, 'string');
|
||||
|
||||
if (!safe.fs.existsSync(filename)) throw new BoxError(BoxError.NOT_FOUND, `Path ${filename} does not exist`);
|
||||
|
||||
const [error, output] = await safe(shell.spawn('df', ['-B1', '--output=source,fstype,size,used,avail,pcent,target', filename], { encoding: 'utf8', timeout: 5000 }));
|
||||
if (error) {
|
||||
debug(`file: df command failed. error: ${error}\n stdout: ${error.stdout}\n stderr: ${error.stderr}`);
|
||||
|
||||
Reference in New Issue
Block a user