cmd/dlv: fix exit status for trace subcommand (#3263)
We currently return an error when the command exits because a process exited error is always returned. Detect this like we do in other code paths to return a 0 exit code instead of nonzero which indicates the command itself failed and can confuse other tools.
This commit is contained in:
parent
436fed8ec4
commit
98f6d0b619
@ -732,7 +732,9 @@ func traceCmd(cmd *cobra.Command, args []string) {
|
||||
err = cmds.Call("continue", t)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
return 1
|
||||
if !strings.Contains(err.Error(), "exited") {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}()
|
||||
|
||||
@ -1038,7 +1038,7 @@ func TestTrace2(t *testing.T) {
|
||||
if !bytes.Contains(output, expected) {
|
||||
t.Fatalf("expected:\n%s\ngot:\n%s", string(expected), string(output))
|
||||
}
|
||||
cmd.Wait()
|
||||
assertNoError(cmd.Wait(), t, "cmd.Wait()")
|
||||
}
|
||||
|
||||
func TestTraceMultipleGoroutines(t *testing.T) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user