Skip to content

Commit

Permalink
Merge pull request #18936 from storybookjs/fix/sandbox-on-cancel
Browse files Browse the repository at this point in the history
Exit sandbox gracefully on cancel
  • Loading branch information
shilman authored Aug 15, 2022
2 parents 3ddfe20 + c6f2d4e commit e1c59ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,12 @@ export async function promptOptions<TOptions extends OptionSpecifier>(
};
});

const selection = await prompts(questions);
const selection = await prompts(questions, {
onCancel: () => {
console.log('Command cancelled by the user. Exiting...');
process.exit(1);
},
});
// Again the structure of the questions guarantees we get responses of the type we need
return selection as OptionValues<TOptions>;
}
Expand Down

0 comments on commit e1c59ee

Please sign in to comment.