From 1ba286cccc75daf9ba82e01a845210a3125284c4 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 1 Jul 2019 08:34:25 +0200 Subject: [PATCH] src: don't abort on EIO when restoring tty EIO has been observed to be returned by the Linux kernel under some circumstances. Reading through drivers/tty/tty_io*.c, it seems to indicate the tty went away. Of course none of this is documented. Fixes: https://github.com/nodejs/node/issues/28479 --- src/node.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 9b4328d2ec8490..9fdef1a2595895 100644 --- a/src/node.cc +++ b/src/node.cc @@ -692,7 +692,10 @@ void ResetStdio() { do err = tcsetattr(fd, TCSANOW, &s.termios); while (err == -1 && errno == EINTR); // NOLINT - CHECK_NE(err, -1); + // EIO has been observed to be returned by the Linux kernel under some + // circumstances. Reading through drivers/tty/tty_io*.c, it seems to + // indicate the tty went away. Of course none of this is documented. + CHECK_IMPLIES(err == -1, errno == EIO); } } #endif // __POSIX__