Skip to content

Commit 5f071bc

Browse files
committed
delete results for skipped step
1 parent 2343be2 commit 5f071bc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/cli/src/command-helpers/prompt-manager.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ export class PromptManager {
1818
// allows going back with Escape and returns the results
1919
async executeInteractive() {
2020
let isCtrlC = false;
21-
// gluegun always throws empty string, so we have this workaround
21+
// gluegun always throws empty string so we don't know what caused the exception, so we need this workaround to handle Ctrl+C
2222
const keypressHandler = (_: string, key: { name: string; ctrl: boolean }) => {
23-
if (key.ctrl && key.name === 'c') {
24-
isCtrlC = true;
25-
}
23+
isCtrlC = key.ctrl && key.name === 'c';
2624
};
2725
process.stdin.on('keypress', keypressHandler);
2826

@@ -42,6 +40,7 @@ export class PromptManager {
4240
process.stdout.write('\x1b[1A\x1b[2K\x1b[1A\x1b[2K');
4341
this.currentStep--;
4442
while (this.currentStep > 0) {
43+
delete this.results[this.currentStep];
4544
const skip = this.steps[this.currentStep].skip;
4645
const shouldSkip = typeof skip === 'function' ? await skip({}) : skip;
4746
if (!shouldSkip) break;

0 commit comments

Comments
 (0)