@@ -42,20 +42,22 @@ function createWritableStdioStream(fd) {
42
42
let stream ;
43
43
// Note stream._type is used for test-module-load-list.js
44
44
switch ( guessHandleType ( fd ) ) {
45
- case 'TTY' :
45
+ case 'TTY' : {
46
46
const tty = require ( 'tty' ) ;
47
47
stream = new tty . WriteStream ( fd ) ;
48
48
stream . _type = 'tty' ;
49
49
break ;
50
+ }
50
51
51
- case 'FILE' :
52
+ case 'FILE' : {
52
53
const SyncWriteStream = require ( 'internal/fs/sync_write_stream' ) ;
53
54
stream = new SyncWriteStream ( fd , { autoClose : false } ) ;
54
55
stream . _type = 'fs' ;
55
56
break ;
57
+ }
56
58
57
59
case 'PIPE' :
58
- case 'TCP' :
60
+ case 'TCP' : {
59
61
const net = require ( 'net' ) ;
60
62
61
63
// If fd is already being used for the IPC channel, libuv will return
@@ -78,8 +80,9 @@ function createWritableStdioStream(fd) {
78
80
79
81
stream . _type = 'pipe' ;
80
82
break ;
83
+ }
81
84
82
- default :
85
+ default : {
83
86
// Provide a dummy black-hole output for e.g. non-console
84
87
// Windows applications.
85
88
const { Writable } = require ( 'stream' ) ;
@@ -88,6 +91,7 @@ function createWritableStdioStream(fd) {
88
91
cb ( ) ;
89
92
}
90
93
} ) ;
94
+ }
91
95
}
92
96
93
97
// For supporting legacy API we put the FD here.
@@ -147,22 +151,24 @@ function getStdin() {
147
151
const fd = 0 ;
148
152
149
153
switch ( guessHandleType ( fd ) ) {
150
- case 'TTY' :
154
+ case 'TTY' : {
151
155
const tty = require ( 'tty' ) ;
152
156
stdin = new tty . ReadStream ( fd , {
153
157
highWaterMark : 0 ,
154
158
readable : true ,
155
159
writable : false
156
160
} ) ;
157
161
break ;
162
+ }
158
163
159
- case 'FILE' :
164
+ case 'FILE' : {
160
165
const fs = require ( 'fs' ) ;
161
166
stdin = new fs . ReadStream ( null , { fd : fd , autoClose : false } ) ;
162
167
break ;
168
+ }
163
169
164
170
case 'PIPE' :
165
- case 'TCP' :
171
+ case 'TCP' : {
166
172
const net = require ( 'net' ) ;
167
173
168
174
// It could be that process has been started with an IPC channel
@@ -187,13 +193,15 @@ function getStdin() {
187
193
// Make sure the stdin can't be `.end()`-ed
188
194
stdin . _writableState . ended = true ;
189
195
break ;
196
+ }
190
197
191
- default :
198
+ default : {
192
199
// Provide a dummy contentless input for e.g. non-console
193
200
// Windows applications.
194
201
const { Readable } = require ( 'stream' ) ;
195
202
stdin = new Readable ( { read ( ) { } } ) ;
196
203
stdin . push ( null ) ;
204
+ }
197
205
}
198
206
199
207
// For supporting legacy API we put the FD here.
0 commit comments