Commands with input set to none would not have stdin closed

This meant if such command would read from its stdin, it would hang.

Fixes #1081
This commit is contained in:
Allan Odgaard
2013-08-21 22:46:53 +02:00
parent b5b029407d
commit 2022fab80c

View File

@@ -62,7 +62,7 @@ namespace command
int inputPipe[2];
pipe(inputPipe);
fcntl(inputPipe[1], F_SETFD, FD_CLOEXEC);
_input_range = _command.input == input::nothing ? text::range_t::undefined : _delegate->write_unit_to_fd(inputPipe[1], _command.input, _command.input_fallback, _command.input_format, _command.scope_selector, _environment, &_input_was_selection);
_input_range = _command.input == input::nothing ? (close(inputPipe[1]), text::range_t::undefined) : _delegate->write_unit_to_fd(inputPipe[1], _command.input, _command.input_fallback, _command.input_format, _command.scope_selector, _environment, &_input_was_selection);
// ----------8<----------