From 52ffa98787dccc0ecd02b81b43df715dd9b6e9fe Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 17 Apr 2017 20:39:24 +0100 Subject: [PATCH] When not sending data to a subprocess, close its stdin We were letting stdin untouched, which meant child processes had access to our terminal input. That meant `!fmt` was trying to read from our terminal input and catching keystrokes. Fixes #1281 --- src/shell_manager.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/shell_manager.cc b/src/shell_manager.cc index 357724b1..9404f97a 100644 --- a/src/shell_manager.cc +++ b/src/shell_manager.cc @@ -171,6 +171,8 @@ std::pair ShellManager::eval( close(child_stdin.write_fd()); move(child_stdin.read_fd(), 0); } + else + close(0); close(child_stdout.read_fd()); move(child_stdout.write_fd(), 1);