File tree 2 files changed +18
-18
lines changed 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -770,23 +770,6 @@ exports.crashOnUnhandledRejection = function() {
770
770
( err ) => process . nextTick ( ( ) => { throw err ; } ) ) ;
771
771
} ;
772
772
773
- exports . getTTYfd = function getTTYfd ( ) {
774
- const tty = require ( 'tty' ) ;
775
- let tty_fd = 0 ;
776
- if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
777
- else if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
778
- else if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
779
- else {
780
- try {
781
- tty_fd = fs . openSync ( '/dev/tty' ) ;
782
- } catch ( e ) {
783
- // There aren't any tty fd's available to use.
784
- return - 1 ;
785
- }
786
- }
787
- return tty_fd ;
788
- } ;
789
-
790
773
// Hijack stdout and stderr
791
774
const stdWrite = { } ;
792
775
function hijackStdWritable ( name , listener ) {
Original file line number Diff line number Diff line change @@ -256,7 +256,24 @@ if (common.hasCrypto) { // eslint-disable-line crypto-check
256
256
257
257
{
258
258
// Do our best to grab a tty fd.
259
- const tty_fd = common . getTTYfd ( ) ;
259
+ function getTTYfd ( ) {
260
+ const tty = require ( 'tty' ) ;
261
+ let tty_fd = 0 ;
262
+ if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
263
+ else if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
264
+ else if ( ! tty . isatty ( tty_fd ) ) tty_fd ++ ;
265
+ else {
266
+ try {
267
+ tty_fd = fs . openSync ( '/dev/tty' ) ;
268
+ } catch ( e ) {
269
+ // There aren't any tty fd's available to use.
270
+ return - 1 ;
271
+ }
272
+ }
273
+ return tty_fd ;
274
+ }
275
+
276
+ const tty_fd = getTTYfd ( ) ;
260
277
if ( tty_fd >= 0 ) {
261
278
const tty_wrap = process . binding ( 'tty_wrap' ) ;
262
279
// fd may still be invalid, so guard against it.
You can’t perform that action at this time.
0 commit comments