Repository navigation
Add flag to disable terminal clear in --watch mode #45713
Description
Activity
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Dec 2, 2022 - addedwatch-modeIssues and PRs related to watch mode.Issues and PRs related to watch mode.
on Dec 2, 2022 sounds like a flag/config that can be added 👍🏻
Reacted by silverwind- addedgood first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
on Dec 2, 2022 - changed the title
[-]`--watch` should not clear terminal[/-][+]Add flag to disable terminal clear in `--watch` mode[/+]on Dec 2, 2022 Thanks, updated issue title and I also investigated nodemon, they default to not clearing but there are various supported ways to achieve clearing. I think it should be definitely made configurable because user preferences vary.
Reacted by Moshe Atlowhello, how taking a stab at the issue, how do I whitelist a command/flag
I am getting this error messageout/Release/node: bad option: --dont-clear-on-restartany pointers would be very much appreciatedThank you!
cc @MoLowOk was able to figure out have started a draft PR, attempting to add tests
Quoting myself from #45717:
Is clearing the terminal really a good default choice? Doesn't that potentially take away error messages etc., depending on the terminal host? What if stdout is not a TTY?
Reacted by Debadree Chatterjee, Yahor Siarheyenka, Cameron Tacklind, Mikael Finstad and Blake Williams- added a commit that references this issue
on Dec 11, 2022 - added a commit that references this issue
on Dec 11, 2022 - added 2 commits that reference this issue
on Dec 12, 2022
What is the problem this feature will solve?
Currently
--watchclears the terminal every time it restarts the process. This can hide vital information that the process logs on shutdown or from other processes running in the same terminal.What is the feature you are proposing to solve the problem?
Remove the terminal clearing because it is opinionated. If this is not desired, make it opt-out via a flag like TypeScript's
preserveWatchOutputor the nodemon solution.What alternatives have you considered?
nodemonalso does not clear terminal on restart, so it is an alternative.