diff --git a/interp/interp.go b/interp/interp.go index 1bf5311..3de3de1 100644 --- a/interp/interp.go +++ b/interp/interp.go @@ -288,7 +288,7 @@ func execProgram(p *interp, program *Program) (int, error) { // Execute the program! BEGIN, then pattern/actions, then END err := p.execBeginEnd(program.Begin) if err != nil && err != errExit { - return 0, err + return p.exitStatus, err } if program.Actions == nil && program.End == nil { return p.exitStatus, nil