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

fix(run): Preserve none zero exit code #6926

Merged
merged 12 commits into from
Mar 14, 2019
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.exit(78);
7 changes: 7 additions & 0 deletions __tests__/fixtures/index/preserve-exit-code/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"license": "MIT",
"scripts": {
"exitWithCode78": "node exitWithCode78.js"
}
}

5 changes: 5 additions & 0 deletions src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {spawnp, forkp} from '../util/child.js';
import {version} from '../util/yarn-version.js';
import handleSignals from '../util/signal-handler.js';
import {boolify, boolifyWithDefault} from '../util/conversion.js';
import {ProcessTermError} from '../errors';

function findProjectRoot(base: string): string {
let prev = null;
Expand Down Expand Up @@ -583,6 +584,10 @@ export async function main({
reporter.info(command.getDocsInfo);
}

if (err instanceof ProcessTermError) {
return exit(err.EXIT_CODE || 1);
}

zhigang1992 marked this conversation as resolved.
Show resolved Hide resolved
return exit(1);
});
}
Expand Down