Skip to content

Commit 292f1a4

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 3a7aab8 commit 292f1a4

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
@@ -455,11 +455,15 @@ export const gitStackedRebase = async (
455455
);
456456

457457
if (!wasRegularRebaseInProgress || options.viewTodoOnly) {
458-
if (options.editor instanceof Function) {
459-
await options.editor({ filePath: pathToStackedRebaseTodoFile });
460-
} else {
461-
process.stdout.write("\nhint: Waiting for your editor to close the file... ");
462-
execSyncInRepo(`${options.editor} ${pathToStackedRebaseTodoFile}`);
458+
try {
459+
if (options.editor instanceof Function) {
460+
await options.editor({ filePath: pathToStackedRebaseTodoFile });
461+
} else {
462+
process.stdout.write("\nhint: Waiting for your editor to close the file... ");
463+
execSyncInRepo(`${options.editor} ${pathToStackedRebaseTodoFile}`);
464+
}
465+
} catch (_e) {
466+
throw new Termination(`error: There was a problem with the editor '${options.editor}'.\n`);
463467
}
464468
}
465469

0 commit comments

Comments
 (0)