-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log stdout
when exec errors
#1495
Conversation
clab/exec/exec.go
Outdated
var s strings.Builder | ||
|
||
s.WriteString(fmt.Sprintf("Cmd: %s\nReturnCode: %d", e.GetCmdString(), e.ReturnCode)) | ||
|
||
if e.Stdout != "" { | ||
s.WriteString(fmt.Sprintf("\nStdout: %s", e.Stdout)) | ||
} | ||
if e.Stderr != "" { | ||
s.WriteString(fmt.Sprintf("\nStderr: %s", e.Stderr)) | ||
} | ||
|
||
return s.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steiler I think I am going mad lol
For some reason the logger eats up the first character when printing it the Stdout:
here.
I am curious if you can crack this mystery:
DEBU[0002] mgmt_server status check failed, output:
Cmd: sr_cli -d info from state system app-management application mgmt_server state | grep running
ReturnCode: 126
tdout: OCI runtime exec failed: exec failed: unable to start container process: exec: "sr_cli": executable file not found in $PATH: unknown
Note, the tdout
string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this log message to appear, change the command here from sr_cli to some garbage
Line 109 in ada8a8d
mgmtServerRdyCmd = `sr_cli -d "info from state system app-management application mgmt_server state | grep running"` |
Codecov Report
@@ Coverage Diff @@
## main #1495 +/- ##
==========================================
- Coverage 21.08% 21.05% -0.03%
==========================================
Files 65 65
Lines 7063 7073 +10
==========================================
Hits 1489 1489
- Misses 5443 5453 +10
Partials 131 131
|
When docker exec fails to find a command to run it seems it puts it in the stdout, rather than stderr.
This new log print prints stderr and stdout when exec errors or contains non 0 rc.