Skip to content

Commit fe9b2ba

Browse files
committed
land: fix --abort exit status code
`--abort` shouldn't exit with error status code unless something goes wrong.
1 parent d8c024d commit fe9b2ba

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/landing_session.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class LandingSession extends Session {
3838
const shouldContinue = await cli.prompt(
3939
`This PR ${status} to land, do you want to continue?`, { defaultAnswer });
4040
if (!shouldContinue) {
41+
cli.setExitCode(1);
4142
return this.abort(false);
4243
}
4344

@@ -47,13 +48,19 @@ class LandingSession extends Session {
4748
}
4849

4950
async abort(tryResetBranch = true) {
50-
const { cli } = this;
51-
this.cleanFiles();
52-
if (tryResetBranch) {
53-
await this.tryResetBranch();
51+
try {
52+
const { cli } = this;
53+
this.cleanFiles();
54+
if (tryResetBranch) {
55+
await this.tryResetBranch();
56+
}
57+
cli.ok(`Aborted \`git node land\` session in ${this.ncuDir}`);
58+
} catch (ex) {
59+
const { cli } = this;
60+
cli.setExitCode(1);
61+
cli.error(`Couldn't abort \`git node land\` session in ${this.ncuDir}`);
62+
throw ex;
5463
}
55-
cli.ok(`Aborted \`git node land\` session in ${this.ncuDir}`);
56-
cli.setExitCode(1);
5764
}
5865

5966
async downloadAndPatch() {

0 commit comments

Comments
 (0)