Skip to content

Commit

Permalink
interp: expand a bit on exit vs lastExit
Browse files Browse the repository at this point in the history
The difference is a bit subtle.
  • Loading branch information
mvdan committed Feb 15, 2020
1 parent b71ab34 commit 7a8db93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions interp/interp.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,15 @@ type Runner struct {
noErrExit bool

err error // current shell exit code or fatal error
exit int // current exit status code
lastExit int // last exit status code
exitShell bool // whether the shell needs to exit

// The current and last exit status code. They can only be different if
// the interpreter is in the middle of running a statement. In that
// scenario, 'exit' is the status code for the statement being run, and
// 'lastExit' corresponds to the previous statement that was run.
exit int
lastExit int

bgShells errgroup.Group

opts runnerOpts
Expand Down

0 comments on commit 7a8db93

Please sign in to comment.