mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-01 20:38:09 -05:00
The output might be written to the pipe by `flatpak --help` and/or read from the pipe by `head -2` in more than one batch. If `head -2` reads the first two lines before `flatpak --help` has written everything, it will exit, causing the pipe to have no process at the read end. This results in `flatpak --help` being killed by `SIGPIPE` next time it tries to write to the pipe, because it has not opted out of this behaviour (as shell tools usually shouldn't). We're running under `set -o pipefail`, so this causes a nonzero exit status that makes the test fail. Worse, this failure is intermittent, because `head -2` *usually* doesn't exit until `flatpak --help` has already written out everything it is going to write - it depends on the precise behaviour of read(), write() and kernel scheduling. We know that `flatpak --help` output is not *that* long, so it's OK for `flatpak --help` not to be terminated early: we can send it all into an intermediate file, and then run `head` on the file. Signed-off-by: Simon McVittie <smcv@collabora.com>
3.8 KiB
Executable File
3.8 KiB
Executable File