Repository navigation
Conversation
Signed-off-by: Yusuke Sakurai <yusuke.sakurai@3-shake.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the changes that expose command failures on stderr when logs are redirected.
No open issues 🎉
What changed in this PR
This PR improves error reporting for failed youki exec and youki run commands when --log redirects logs to a file, allowing callers such as conmon to obtain the failure reason from stderr.
Changes:
- Adds a shared error-reporting helper that preserves logging and also prints to stderr when
--logis set. - Adds regression tests for both commands, checking file logging and ensuring errors appear only once on stderr without
--log.
| File | Description |
|---|---|
crates/youki/tests/error_output.rs |
Tests error output with and without a log file using invalid container IDs. |
crates/youki/src/main.rs |
Shares error reporting between exec and run and adds stderr output when logging to a file. |
Review effort: Balanced
nayuta723
approved these changes
Nov 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
With
--log <file>, tracing writes only to that file.execandrunleave throughprocess::exitinstead of returning the error frommain, so when they failed nothing was written to stderr. conmon falls back to the runtime's stderr when it cannot use the log file, sopodman execshowed "no logs from conmon" instead of the reason.Print the error to stderr as well when the log goes to a file, as runc and crun do. Without
--logthe log is already stderr, so the output there does not change.Type of Change
Testing
Please specify a nonexistent command in the args field of the config.
youki
Before this change, no error message was displayed. After this change, the following error message is displayed.
runc
Related Issues
Related #3670
Additional Context
This change addresses error reporting for podman exec. The error reporting issue with podman run is separate.
As discussed in #3670, older versions of Podman fail to parse the runtime log when youki writes multiple JSON objects to the log file.
This issue has already been addressed on the Podman side in podman-container-tools/podman#29026, although the fix is not yet included in v6.2.1.