Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/embark-contracts-manager/src/index.js
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion packages/embark-core/src/processes/processWrapper.js
Expand Up @@ -31,7 +31,7 @@ export class ProcessWrapper {
function error() {
if (self.retries > 2) {
self.kill();
process.exit();
process.exit(1);
}
self.retries++;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/embark-test-runner/src/index.js
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions packages/embark/src/cmd/cmd_controller.js
Expand Up @@ -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'));
Expand Down Expand Up @@ -406,7 +406,7 @@ class EmbarkController {
engine.logger.info(__("Done. %s generated", options.output).underline);
});
}
process.exit();
process.exit(err ? 1 : 0);
});

}
Expand Down Expand Up @@ -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);
});
}

Expand Down Expand Up @@ -610,15 +610,15 @@ 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 {
engine.logger.info((__("finished building DApp and deploying to") + " " + platform).underline);
}

// needed due to child processes
process.exit();
process.exit(err ? 1 : 0);
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/embark/src/cmd/dashboard/repl.js
Expand Up @@ -112,7 +112,7 @@ class REPL {
});

this.replServer.on("exit", () => {
process.exit();
process.exit(0);
});

done();
Expand Down
Expand Up @@ -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;
Expand Down