Closed geissonator closed 6 years ago
@amboar mentioned maybe just a "|| true" to the line instead of removing -e is a better option.
The exit code
141 = 128 + 13 = 0x80 | SIGPIPE
so this error occurs because the
trap '' SIGPIPE
is not blocking SIGPIPE
in this pipeline. The shell probably sets it to a handler which the results in default vs ignored signal behavior being inherited
This seems to match the bash documentation (under paragraph When a simple command
... is to be executed,
)
· traps caught by the shell are reset to the values inherited from
the shell's parent, and traps ignored by the shell are ignored
Other options might be to use awk
to consume all the output instead of the pipeline of grep
and cut
, or to turn off pipefail
for this pipeline.
Another option would be to take the last ip instead of the first so that all the output would be consumed ... remove the -m1
from grep
and add tail -n1
to the pipeline.
so like this @mdmillerii ?
docker inspect $obmc_qemu_docker | grep "IPAddress\":" | tail -n1 | cut -d '"' -f 4
seems to work as expected
$ docker inspect 58f8e191310a | grep "IPAddress\":" | cut -d '"' -f 4
172.17.0.6
172.17.0.6
$ docker inspect 58f8e191310a | grep "IPAddress\":" | tail -n1 | cut -d '"' -f 4
172.17.0.6
From discussion the address appears under multiple elements but the last seems to work as well as the first, and has the advantage of consuming the entire output.
I've tried a couple fixes for this but not having much luck. Intermittently, our command to get the IP address of the docker container we launch QEMU in with this command:
Gets this error:
I'm thinking we just ensure the script handles errors properly and remove the "-e" from the top of run-qemu-robot-test.sh.