Commit 923167cf authored by rockyl's avatar rockyl

exit code

parent 5ab9ab60
...@@ -10,7 +10,7 @@ const {generateDeclareMap} = require('../src/index'); ...@@ -10,7 +10,7 @@ const {generateDeclareMap} = require('../src/index');
exports.execute = async function (program) { exports.execute = async function (program) {
if (!program.input) { if (!program.input) {
console.warn('parameter is incorrect'); console.warn('parameter is incorrect');
process.exit(1); return 1;
} }
const componentsPath = program.projectPath || path.join(os.homedir(), '.scilla', 'components'); const componentsPath = program.projectPath || path.join(os.homedir(), '.scilla', 'components');
...@@ -44,7 +44,7 @@ exports.execute = async function (program) { ...@@ -44,7 +44,7 @@ exports.execute = async function (program) {
if (Object.keys(missingDependencies).length > 0) { if (Object.keys(missingDependencies).length > 0) {
console.warn(JSON.stringify(missingDependencies, null, '\t')); console.warn(JSON.stringify(missingDependencies, null, '\t'));
process.exit(2); return 2;
} }
fs.writeJsonSync(outputFile, declareMap); fs.writeJsonSync(outputFile, declareMap);
......
...@@ -16,7 +16,13 @@ program ...@@ -16,7 +16,13 @@ program
.option('-v, --verbose [boolean]', 'verbose mode', false) .option('-v, --verbose [boolean]', 'verbose mode', false)
.parse(process.argv); .parse(process.argv);
execute(program).catch(e=>{ execute(program).then(
code=>{
if(code > 0){
process.exit(code)
}
}
).catch(e=>{
console.error(e); console.error(e);
process.exit(2); process.exit(99);
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment