File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
packages/core/src/prompts Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @clack/core " : patch
3+ ---
4+
5+ Fix "TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)" error happening on Windows for non-tty terminals.
Original file line number Diff line number Diff line change 11import { stdin , stdout } from 'node:process' ;
22import readline , { type Key , type ReadLine } from 'node:readline' ;
3- import type { Readable , Writable } from 'node:stream' ;
4- import { WriteStream } from 'node:tty ' ;
3+ import type { Readable } from 'node:stream' ;
4+ import { Writable } from 'node:stream ' ;
55import { cursor , erase } from 'sisteransi' ;
66import wrap from 'wrap-ansi' ;
77
@@ -133,7 +133,7 @@ export default class Prompt {
133133 ) ;
134134 }
135135
136- const sink = new WriteStream ( 0 ) ;
136+ const sink = new Writable ( ) ;
137137 sink . _write = ( chunk , encoding , done ) => {
138138 if ( this . _track ) {
139139 this . value = this . rl ?. line . replace ( / \t / g, '' ) ;
@@ -150,6 +150,7 @@ export default class Prompt {
150150 tabSize : 2 ,
151151 prompt : '' ,
152152 escapeCodeTimeout : 50 ,
153+ terminal : true ,
153154 } ) ;
154155 readline . emitKeypressEvents ( this . input , this . rl ) ;
155156 this . rl . prompt ( ) ;
You can’t perform that action at this time.
0 commit comments