Skip to content

Commit d7f1ea0

Browse files
committed
exit with clear message if editor exits with error, instead of blowing up
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent f08baf9 commit d7f1ea0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

git-stacked-rebase.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,15 @@ export const gitStackedRebase = async (
346346
);
347347

348348
if (!wasRegularRebaseInProgress || options.viewTodoOnly) {
349-
if (options.editor instanceof Function) {
350-
await options.editor({ filePath: pathToStackedRebaseTodoFile });
351-
} else {
352-
process.stdout.write("\nhint: Waiting for your editor to close the file... ");
353-
execSyncInRepo(`${options.editor} ${pathToStackedRebaseTodoFile}`);
349+
try {
350+
if (options.editor instanceof Function) {
351+
await options.editor({ filePath: pathToStackedRebaseTodoFile });
352+
} else {
353+
process.stdout.write("\nhint: Waiting for your editor to close the file... ");
354+
execSyncInRepo(`${options.editor} ${pathToStackedRebaseTodoFile}`);
355+
}
356+
} catch (_e) {
357+
throw new Termination(`error: There was a problem with the editor '${options.editor}'.\n`);
354358
}
355359
}
356360

0 commit comments

Comments
 (0)