@@ -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,18 +151,20 @@ 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
break ;
158
+ }
154
159
155
- case 'FILE' :
160
+ case 'FILE' : {
156
161
const fs = require ( 'fs' ) ;
157
162
stdin = new fs . ReadStream ( null , { fd : fd , autoClose : false } ) ;
158
163
break ;
164
+ }
159
165
160
166
case 'PIPE' :
161
- case 'TCP' :
167
+ case 'TCP' : {
162
168
const net = require ( 'net' ) ;
163
169
164
170
// It could be that process has been started with an IPC channel
@@ -183,13 +189,15 @@ function getStdin() {
183
189
// Make sure the stdin can't be `.end()`-ed
184
190
stdin . _writableState . ended = true ;
185
191
break ;
192
+ }
186
193
187
- default :
194
+ default : {
188
195
// Provide a dummy contentless input for e.g. non-console
189
196
// Windows applications.
190
197
const { Readable } = require ( 'stream' ) ;
191
198
stdin = new Readable ( { read ( ) { } } ) ;
192
199
stdin . push ( null ) ;
200
+ }
193
201
}
194
202
195
203
// For supporting legacy API we put the FD here.
0 commit comments