Commit 923167cf authored by rockyl's avatar rockyl

exit code

parent 5ab9ab60
......@@ -10,7 +10,7 @@ const {generateDeclareMap} = require('../src/index');
exports.execute = async function (program) {
if (!program.input) {
console.warn('parameter is incorrect');
process.exit(1);
return 1;
}
const componentsPath = program.projectPath || path.join(os.homedir(), '.scilla', 'components');
......@@ -44,7 +44,7 @@ exports.execute = async function (program) {
if (Object.keys(missingDependencies).length > 0) {
console.warn(JSON.stringify(missingDependencies, null, '\t'));
process.exit(2);
return 2;
}
fs.writeJsonSync(outputFile, declareMap);
......
......@@ -16,7 +16,13 @@ program
.option('-v, --verbose [boolean]', 'verbose mode', false)
.parse(process.argv);
execute(program).catch(e=>{
execute(program).then(
code=>{
if(code > 0){
process.exit(code)
}
}
).catch(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