Alexander Turenko
authored
The function popen_shutdown() checks whether std{in,out,err} was piped and closes the parent's end. A user should have ability to send EOF for child's stdin for stream programs like `grep`. It is better when there is a function that encapsulates proper checks, error messages and the actual actions. This commit in particular reverts 1ef95b99 ('popen: remove redundant fd check before perform IO'), because now the check is meaningful: an fd may become closed before the whole popen handle will be deleted. Part of #4031 Acked-by:Cyrill Gorcunov <gorcunov@gmail.com>