mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
fix(validate) corruption of config when root not found
This commit is contained in:
parent
4ff7973d43
commit
eb6a79cf97
2 changed files with 14 additions and 11 deletions
|
|
@ -1,5 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
const tryCatch = require('try-catch');
|
||||
|
||||
const config = require('./config');
|
||||
const exit = require('./exit');
|
||||
const columns = require('./columns');
|
||||
|
|
@ -14,15 +16,14 @@ module.exports.root = (dir, fn) => {
|
|||
if (config('dropbox'))
|
||||
return;
|
||||
|
||||
const fs = require('fs');
|
||||
const {statSync} = require('fs');
|
||||
const [error] = tryCatch(statSync, dir);
|
||||
|
||||
fs.stat(dir, (error) => {
|
||||
if (error)
|
||||
return exit('cloudcmd --root: %s', error.message);
|
||||
|
||||
if (typeof fn === 'function')
|
||||
fn('root:', dir);
|
||||
});
|
||||
if (error)
|
||||
return exit('cloudcmd --root: %s', error.message);
|
||||
|
||||
if (typeof fn === 'function')
|
||||
fn('root:', dir);
|
||||
};
|
||||
|
||||
module.exports.editor = (name) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue