Skip to content

Commit

Permalink
fix error output, when execution err is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhitena committed Nov 25, 2016
1 parent f7e3d9a commit a58a2bd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ func (s *Session) Eval(in string) (string, bytes.Buffer, error) {
s.doQuickFix()

output, stderr, runErr := s.Run()
if runErr != nil {
if runErr != nil || stderr.String() != "" {
if exitErr, ok := runErr.(*exec.ExitError); ok {
// if failed with status 2, remove the last statement
if st, ok := exitErr.ProcessState.Sys().(syscall.WaitStatus); ok {
Expand All @@ -418,6 +418,11 @@ func (s *Session) Eval(in string) (string, bytes.Buffer, error) {
return string(output), stderr, err
}

// Catch any unexpected stderr.
if stderr.String() != "" {
runErr = errors.New("Unexpected stderr from execution")
}

return string(output), stderr, runErr
}

Expand Down

0 comments on commit a58a2bd

Please sign in to comment.