Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ class CLI {
this.log(prefix + chalk.bold(`${error} ${obj}`));
}
}

setExitCode(statusCode) {
process.exitCode = statusCode;
}
};

CLI.SPINNER_STATUS = SPINNER_STATUS;
Expand Down
1 change: 1 addition & 0 deletions lib/landing_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class LandingSession extends Session {
await this.tryResetBranch();
}
cli.ok(`Aborted \`git node land\` session in ${this.ncuDir}`);
cli.setExitCode(1);
}

async downloadAndPatch() {
Expand Down
5 changes: 5 additions & 0 deletions lib/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Session {
if (!new RegExp(`${owner}/${repo}(?:.git)?$`).test(upstreamHref)) {
cli.warn('Remote repository URL does not point to the expected ' +
`repository ${owner}/${repo}`);
cli.setExitCode(1);
}
}

Expand Down Expand Up @@ -343,6 +344,7 @@ class Session {
'`master` branch, you can run:\n\n' +
' $ ncu-config set branch master');
cli.separator();
cli.setExitCode(1);
}
if (!upstream) {
cli.warn('You have not told git-node the remote you want to sync with.');
Expand All @@ -352,6 +354,7 @@ class Session {
' `remote-upstream`, you can run:\n\n' +
' $ ncu-config set upstream remote-upstream');
cli.separator();
cli.setExitCode(1);
}
return missing;
}
Expand All @@ -363,6 +366,7 @@ class Session {
cli.warn(
'You are in detached HEAD state. Please run git-node on a valid ' +
'branch');
cli.setExitCode(1);
return true;
}
if (rev === branch) {
Expand All @@ -377,6 +381,7 @@ class Session {
' reconfigure the target branch with:\n\n' +
` $ ncu-config set branch ${rev}`);
cli.separator();
cli.setExitCode(1);
return true;
// TODO warn if backporting onto master branch
}
Expand Down