mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
d1d13d9ac3
For test cases where we used pipes for container's stdin/stdout/stderr, stderr was redirected to the same pipe as stdout, which practically means it is lost. These redirects to fd is needed not because we check that container is working by writing to its stdin and reading from stdout (see check_pipes), but also because bats redirects test stdout/stderr to a file, which makes c/r impossible (as the file is outside of container). This is why we can't just do something like `2>stderr.log`, and have to do what is done in this commit. Introduce and use another pipe for stdout, to be used for both runc run and runc restore, so it will be shown in case of errors. Since its handling is somewhat complicated and is used from 4 places (2 for run, 2 for restore), separate it into a helper functions. NOTE the code assumes that runc exits with non-zero exit code in case there is anything that needs to be shown to a user from runc's stderr. While at it, add error checking to runc run calls. Hopefully, this will help debug those rare checkpoint failures in CI. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>