summaryrefslogtreecommitdiff
path: root/src/node_main_instance.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2019-05-24 16:11:19 +0200
committerRich Trott <rtrott@gmail.com>2019-06-12 20:47:03 -0700
commit5872705796d89d48bc4bf5f0b35678b0bd148ec2 (patch)
treefba35df4d7533287c7144828c8ffa281e9ab41e2 /src/node_main_instance.cc
parent0f900405e52061136f7b5d69e6f2453309064c8a (diff)
downloadandroid-node-v8-5872705796d89d48bc4bf5f0b35678b0bd148ec2.tar.gz
android-node-v8-5872705796d89d48bc4bf5f0b35678b0bd148ec2.tar.bz2
android-node-v8-5872705796d89d48bc4bf5f0b35678b0bd148ec2.zip
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.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_main_instance.cc b/src/node_main_instance.cc
index 5c84dd64e6..f49b9fbb4d 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());