🐛 Don't load 'repl' unless needed #6130
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ever since v0.37.3, process.stdout in the renderer has not worked at all. It turns out that electron's fork of node sets stdout to a stream that does nothing if an error is thrown while creating the stream. I haven't found the root cause of the error, but
guessHandleType(fd)
returns'TCP'
for fd1 in v0.37.3. It used to return'TTY'
in v0.37.2.I did a git bisect and found the first commit that had this issue. Seems like just loading the
repl
module is enough to cause the issue described above. This commit movesrequire('repl')
so that it is only loaded when the --interactive flag is present.I don't know why loading
repl
breaks stdout.I'm not entirely sure how to write a test to verify that stdout is indeed writing to the correct place. It seems like the pending test checking
process.stdout.isTTY
is working now, though.Fixes #5051