From a58a2bd521442ecde2642a1ca5980091dafcba45 Mon Sep 17 00:00:00 2001 From: Daniel Whitenack Date: Fri, 25 Nov 2016 14:32:13 -0500 Subject: [PATCH] fix error output, when execution err is nil --- internal/repl/repl.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/repl/repl.go b/internal/repl/repl.go index 089ac9a..b567193 100644 --- a/internal/repl/repl.go +++ b/internal/repl/repl.go @@ -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 { @@ -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 }