Adrian Ratiu [off-list ref] writes:
Yes, it is odd and it's a weirdness of the run-command.c child fd
handling logic where .in, .out and .err are initialized to 0.
Patrick raised this up as well in one of the previous patches, however
reworking run-command to not use 0 sentinel values for fd's is quite the
big unrelated patch (I gave up after spending about 1.5 days on it at
the time).
Thanks. I didn't realize that this was already discussed.
Maybe one day we can also fix this weird aspect of the run-command API.
At least a comment somewhere would be sufficient to avoid others
waste (your) time like I just did, wondering why fd=0 is special,
even they know that it is unlikely to get fd=0 from a fresh new
open()/dup() etc. in our codebase.
Thanks.