Skip to content

Commit d9e21c9

Browse files
authored
fix(@clack/core): keyboard input not working after await in spinner (#182)
2 parents 90f8e3d + a04e418 commit d9e21c9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/olive-walls-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clack/core': patch
3+
---
4+
5+
fix(@clack/core): keyboard input not working after await in spinner

packages/core/src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { stdin, stdout } from 'node:process';
44
import * as readline from 'node:readline';
55
import { cursor } from 'sisteransi';
66

7+
const isWindows = globalThis.process.platform.startsWith('win');
8+
79
export function block({
810
input = stdin,
911
output = stdout,
@@ -40,7 +42,9 @@ export function block({
4042
return () => {
4143
input.off('keypress', clear);
4244
if (hideCursor) process.stdout.write(cursor.show);
43-
if (input.isTTY) input.setRawMode(false);
45+
46+
// Prevent Windows specific issues: https://github.com/natemoo-re/clack/issues/176
47+
if (input.isTTY && !isWindows) input.setRawMode(false);
4448

4549
// @ts-expect-error fix for https://github.com/nodejs/node/issues/31762#issuecomment-1441223907
4650
rl.terminal = false;

0 commit comments

Comments
 (0)