kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.57k stars 82 forks source link

`--argfile` with command substitution is broken #116

Closed pisto closed 3 years ago

pisto commented 3 years ago

Version: 2.11.1

Command substitution is very handy to combine multiple documents:

[pisto@kp ~]$ jq -n --argfile a <(echo '{"a":"hello"}') --argfile b <(echo '{"b":"world"}') '$a + $b'
{
  "a": "hello",
  "b": "world"
}

but it does not work in yq:

[pisto@kp ~]$ echo | yq -n --argfile a <(echo '{"a":"hello"}') --argfile b <(echo '{"b":"world"}') '$a + $b'
jq: Bad JSON in --argfile a /dev/fd/63: Could not open /dev/fd/63: No such file or directory

This is due to the fact that yq spawns another process, and there file descriptor 63 appears to be invalid. It appears that the fd is being FD_CLOEXEC'd, but I cannot tell why.

kislyuk commented 3 years ago

This is fixed in yq v2.12.1, thanks for reporting.