refactor: use explicit codes with process.exit so intent is clear and errors don't exit cleanly

This commit is contained in:
Michael Bradley, Jr 2019-05-08 14:46:16 -05:00 committed by Michael Bradley
parent 8781585341
commit 2eb5617443
6 changed files with 9 additions and 10 deletions

View File

@ -621,7 +621,6 @@ class ContractsManager {
this.logger.error(__("there are two or more contracts that depend on each other in a cyclic manner").bold.red);
this.logger.error(__("Embark couldn't determine which one to deploy first").red);
throw new Error("CyclicDependencyError");
//process.exit(0);
}
return contractList.sort(function (a, b) {

View File

@ -31,7 +31,7 @@ export class ProcessWrapper {
function error() {
if (self.retries > 2) {
self.kill();
process.exit();
process.exit(1);
}
self.retries++;
}

View File

@ -167,7 +167,7 @@ class TestRunner {
let deprecatedWarning = function () {
self.logger.error(__('%s are not supported anymore', 'EmbarkSpec & deployAll').red);
self.logger.error(__('You can learn about the new revamped tests here: %s', 'https://embark.status.im/docs/testing.html'.underline));
if(!options.inProcess) process.exit();
if(!options.inProcess) process.exit(1);
};
global.deployAll = deprecatedWarning;

View File

@ -259,7 +259,7 @@ class EmbarkController {
}
// TODO: this should be moved out and determined somewhere else
if (canExit || !engine.config.contractsConfig.afterDeploy || !engine.config.contractsConfig.afterDeploy.length) {
process.exit();
process.exit(err ? 1 : 0);
}
engine.logger.info(__('Waiting for after deploy to finish...'));
engine.logger.info(__('You can exit with CTRL+C when after deploy completes'));
@ -406,7 +406,7 @@ class EmbarkController {
engine.logger.info(__("Done. %s generated", options.output).underline);
});
}
process.exit();
process.exit(err ? 1 : 0);
});
}
@ -519,7 +519,7 @@ class EmbarkController {
}
engine.logger.info(__("finished generating the UI").underline);
engine.logger.info(__("To see the result, execute {{cmd}} and go to /{{contract}}.html", {cmd: 'embark run'.underline, contract: options.contract}));
process.exit();
process.exit(0);
});
}
@ -610,7 +610,7 @@ class EmbarkController {
if (err) {
if (err.message) {
engine.logger.error(err.message);
return engine.logger.debug(err.stack);
engine.logger.debug(err.stack);
}
engine.logger.error(err);
} else {
@ -618,7 +618,7 @@ class EmbarkController {
}
// needed due to child processes
process.exit();
process.exit(err ? 1 : 0);
});
}

View File

@ -112,7 +112,7 @@ class REPL {
});
this.replServer.on("exit", () => {
process.exit();
process.exit(0);
});
done();

View File

@ -470,7 +470,7 @@ var BlockchainClient = function(userConfig, clientName, env, certOptions, onRead
break;
default:
console.error(__('Unknown client "%s". Please use one of the following: %s', userConfig.ethereumClientName, Object.keys(constants.blockchain.clients).join(', ')));
process.exit();
process.exit(1);
}
userConfig.isDev = (userConfig.isDev || userConfig.default);
userConfig.env = env;