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 1
1
import { stdin , stdout } from 'node:process' ;
2
2
import 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 ' ;
5
5
import { cursor , erase } from 'sisteransi' ;
6
6
import wrap from 'wrap-ansi' ;
7
7
@@ -133,7 +133,7 @@ export default class Prompt {
133
133
) ;
134
134
}
135
135
136
- const sink = new WriteStream ( 0 ) ;
136
+ const sink = new Writable ( ) ;
137
137
sink . _write = ( chunk , encoding , done ) => {
138
138
if ( this . _track ) {
139
139
this . value = this . rl ?. line . replace ( / \t / g, '' ) ;
@@ -150,6 +150,7 @@ export default class Prompt {
150
150
tabSize : 2 ,
151
151
prompt : '' ,
152
152
escapeCodeTimeout : 50 ,
153
+ terminal : true ,
153
154
} ) ;
154
155
readline . emitKeypressEvents ( this . input , this . rl ) ;
155
156
this . rl . prompt ( ) ;
You can’t perform that action at this time.
0 commit comments