feat: add flag to disable tsx watch from reading from process.stdin #753
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.
Acknowledgements
bug
There are som limitations to an inherited stdin:
proposal
Add an option to disable the stdin reads for the reload check
The default was selected so as to not introduce a breaking change.
The flag name
--reload-on-keypress(a bit inexact), was chosen to leave room for the reload triggering key to change via a future flag.Relevant issues:
process.stdin.isRawdoes not necessarily reflect the actual mode tty.ReadStream.isRaw is not reliable on child processes nodejs/node#47938other notes
the child sharing a stdin adds some complications, as the child may expect a certain mode or change the mode. its possible to instead do set stdin to
'pipe'in the spawn config, set the parent in raw mode, and pipe input into the child. another alternative may be to give the child a pseudoterminal https://github.com/microsoft/node-ptyi haven't explored these options in depth