diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2019-05-24 17:11:19 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-06-13 06:47:03 +0300 |
commit | 5872705796d89d48bc4bf5f0b35678b0bd148ec2 (patch) | |
tree | fba35df4d7533287c7144828c8ffa281e9ab41e2 /src/node_main_instance.cc | |
parent | 0f900405e52061136f7b5d69e6f2453309064c8a (diff) |
src: restore stdio on program exit
Record the state of the stdio file descriptors on start-up and restore
them to that state on exit. This should prevent issues where node.js
sometimes leaves stdio in raw or non-blocking mode.
This is a reworked version of commit c2c9c0c3d3 from May 2018 that was
reverted in commit 14dc17df38 from June 2018. The revert was a little
light on details but I infer that the problem was caused by a missing
call to `uv_tty_reset_mode()`.
Apropos the NOLINT comments: cpplint doesn't understand do/while
statements, it thinks they're while statements without a body.
Fixes: https://github.com/nodejs/node/issues/14752
Fixes: https://github.com/nodejs/node/issues/21020
Original-PR-URL: https://github.com/nodejs/node/pull/20592
PR-URL: https://github.com/nodejs/node/pull/24260
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_main_instance.cc')
-rw-r--r-- | src/node_main_instance.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc index 5c84dd64e6f..f49b9fbb4d3 100644 --- a/src/node_main_instance.cc +++ b/src/node_main_instance.cc @@ -145,7 +145,7 @@ int NodeMainInstance::Run() { env->set_can_call_into_js(false); env->stop_sub_worker_contexts(); - uv_tty_reset_mode(); + ResetStdio(); env->RunCleanup(); RunAtExit(env.get()); |