Skip to content

Commit bca0a9a

Browse files
fix(compile): init dummy stdin after debug env is initialized (#29144)
This should be the last change to fix #27730 and #21091 The dummy stdin needed when using `--no-terminal` instantly closes, but closing can't be done until the debug environment is initialized. This PR delays creation (and closing) of the stdin until after the debug environment is initialized. Co-authored-by: Divy Srivastava <[email protected]>
1 parent 280f598 commit bca0a9a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/node/polyfills/process.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -996,12 +996,6 @@ internals.__bootstrapNodeProcess = function (
996996
core.setMacrotaskCallback(runNextTicks);
997997
enableNextTick();
998998

999-
// Replace stdin if it is not a terminal
1000-
const newStdin = initStdin();
1001-
if (newStdin) {
1002-
stdin = process.stdin = newStdin;
1003-
}
1004-
1005999
// Replace stdout/stderr if they are not terminals
10061000
if (!io.stdout.isTerminal()) {
10071001
/** https://nodejs.org/api/process.html#process_process_stdout */
@@ -1025,6 +1019,12 @@ internals.__bootstrapNodeProcess = function (
10251019

10261020
initializeDebugEnv(nodeDebug);
10271021

1022+
// Replace stdin if it is not a terminal
1023+
const newStdin = initStdin();
1024+
if (newStdin) {
1025+
stdin = process.stdin = newStdin;
1026+
}
1027+
10281028
delete internals.__bootstrapNodeProcess;
10291029
} else {
10301030
// Warmup, assuming stdin/stdout/stderr are all terminals

0 commit comments

Comments
 (0)