Set stdin to /dev/null instead of closing it when we dont have data to pipe to child

Fixes #1330
Fixes #1331
This commit is contained in:
Maxime Coste 2017-04-22 09:39:00 +01:00
parent e722868c60
commit caed8a55c7

View File

@ -172,7 +172,7 @@ std::pair<String, int> ShellManager::eval(
move(child_stdin.read_fd(), 0); move(child_stdin.read_fd(), 0);
} }
else else
close(0); move(open("/dev/null", O_RDONLY), 0);
close(child_stdout.read_fd()); close(child_stdout.read_fd());
move(child_stdout.write_fd(), 1); move(child_stdout.write_fd(), 1);