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,8 +732,10 @@ func traceCmd(cmd *cobra.Command, args []string) {
|
|||||||
err = cmds.Call("continue", t)
|
err = cmds.Call("continue", t)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
if !strings.Contains(err.Error(), "exited") {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0
|
return 0
|
||||||
}()
|
}()
|
||||||
os.Exit(status)
|
os.Exit(status)
|
||||||
|
|||||||
@ -1038,7 +1038,7 @@ func TestTrace2(t *testing.T) {
|
|||||||
if !bytes.Contains(output, expected) {
|
if !bytes.Contains(output, expected) {
|
||||||
t.Fatalf("expected:\n%s\ngot:\n%s", string(expected), string(output))
|
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) {
|
func TestTraceMultipleGoroutines(t *testing.T) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user