Skip to content

Commit b78366c

Browse files
authored
fix(@clack/prompts): handle spinner.stop call when spinner.start was not called
1 parent 5529c89 commit b78366c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/prompts/src/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ export const spinner = ({ indicator = 'dots' }: SpinnerOptions = {}) => {
729729
const delay = unicode ? 80 : 120;
730730
const isCI = process.env.CI === 'true';
731731

732-
let unblock: () => void;
732+
let unblock: (() => void) | undefined;
733733
let loop: NodeJS.Timeout;
734734
let isSpinnerActive = false;
735735
let _message = '';
@@ -830,7 +830,7 @@ export const spinner = ({ indicator = 'dots' }: SpinnerOptions = {}) => {
830830
process.stdout.write(`${step} ${_message}\n`);
831831
}
832832
clearHooks();
833-
unblock();
833+
unblock?.();
834834
};
835835

836836
const message = (msg = ''): void => {

0 commit comments

Comments
 (0)