-
Notifications
You must be signed in to change notification settings - Fork 2
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
propagating compiler errors #116
Changes from 3 commits
f0b2488
5195b43
7d58b16
0d15f08
1947b55
933bd24
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,12 +102,12 @@ func (ac *AsyncController) SubmitRequest(runprops *Props) *CtrlRunOutput { | |
|
||
if runprops.PreRunProps != nil { | ||
preRunOut, commandErr := agent.SafeRunCmd(preRunProps) | ||
print2.DebugPrintf("error preparing command: output=%v\n \nerror=%v", preRunOut, commandErr) | ||
if commandErr != nil { | ||
print2.DebugPrintf("error preparing command: output=%v\n \nerror=%v", preRunOut, commandErr) | ||
return &CtrlRunOutput{ | ||
ControllerErr: PreRunError, | ||
RunOutput: nil, | ||
CommandErr: nil, | ||
ControllerErr: nil, | ||
RunOutput: preRunOut, | ||
CommandErr: commandErr, | ||
Comment on lines
-108
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before, the PreRunError was being thrown when compile commands would fail. This would make handling compilation errors different from handling runtime errors; I changed it so that both could be handled the same way. |
||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,10 +98,25 @@ func main() { | |
|
||
cmd.Stdout = os.Stdout | ||
cmd.Stderr = os.Stderr | ||
|
||
err = cmd.Run() | ||
|
||
if err != nil { | ||
print.ProcDebug("error running process: %v\n", err) | ||
os.Exit(ERunningProc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linter is complaining about this, not being used, can remove lined 38 as no longer being used? |
||
if cast, ok := err.(*exec.ExitError); ok { | ||
if ws, ok := cast.Sys().(syscall.WaitStatus); ok { | ||
if ws.Signaled() { | ||
// more verbose err message | ||
cmd.Stderr.Write([]byte(err.Error())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This returns a value we may want to sanity check and debug log if it fails. It's unlikely to fail, but we can add visibility there just in case. |
||
|
||
// signal exit code: 128 + signal code | ||
os.Exit(128 + int(ws.Signal())) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. error codes are being captured from the |
||
} | ||
} | ||
|
||
// if for some reason we can't get the wait status then we | ||
// can just get the (probably incorrect) error code from the cast | ||
os.Exit(cast.ExitCode()) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,5 @@ type RunResponse struct { | |
// Stderr is standard error stream from running program | ||
Stderr string `json:"stderr"` | ||
// Error result from either compilation or runtime errors. Will be nil if both compilation and runtime were successful. | ||
Error error `json:"error"` | ||
Error string `json:"error"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One big thing I noticed is that the internal
I would get the right error message, but once it was marshaled, it was returned as an object like
My solution was simply to call the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense to turn into string. Good catch, sorry I should've noticed that if I was writing this before. |
||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is actually looking really great! Not sure if I'll get time to review much before Wednesday, but just wanted to leave that initial feedback! |
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.
Since this is nil should probably just remove altogether.