Node doesn't reset tty on early/aborted exit
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
Version
v16.13.1, v17.2.0 tested
Platform
Linux lux0 5.11.22-100.fc32.x86_64 #1 SMP Wed May 19 18:58:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Create this script file in test.js:
#!/usr/bin/env node
for (let i = 0; i < 100000; i++) {
console.log("i:", i)
}
In a shell window, run:
test.js |less
Hit "q" to quit less (after only one page of output), which also kills test.js while it still has undelivered data in the stdout buffer.
Your tty will be left in raw mode (no echo, other command characters disabled). Must do a "stty sane" to restore usability of the console.
How often does it reproduce? Is there a required condition?
Happens every time. Have tested multiple versions of node on Linux and MacOS.
What is the expected behavior?
Should restore my tty settings no matter how ugly the exit conditions.
What do you see instead?
Tty is left in raw mode with no echo. Can't see my typed commands.
Additional information
Is there a standard way of dealing with this in case a script is killed before it can write its output? Or is this a bug in node?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den Bericht mit dem test.js-Skript und test.js | less zu reproduzieren; untersuche dann, wie Node.js den Terminalzustand während eines abgebrochenen oder vorzeitigen Prozessendes behandelt. Füge Regressionstests für das Beenden von less hinzu, während die Ausgabe noch gepuffert ist, und überprüfe, dass das tty in den normalen Zustand zurückkehrt, ohne stty sane zu benötigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, node.js
- Bereich
- cli, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 45/100