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
This commit is contained in:
Maxime Coste 2017-04-17 20:39:24 +01:00
parent 7482d117cc
commit 52ffa98787

View File

@ -171,6 +171,8 @@ std::pair<String, int> 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);