Skip to content

Commit a58a2bd

Browse files
committed
fix error output, when execution err is nil
1 parent f7e3d9a commit a58a2bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/repl/repl.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ func (s *Session) Eval(in string) (string, bytes.Buffer, error) {
391391
s.doQuickFix()
392392

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

421+
// Catch any unexpected stderr.
422+
if stderr.String() != "" {
423+
runErr = errors.New("Unexpected stderr from execution")
424+
}
425+
421426
return string(output), stderr, runErr
422427
}
423428

0 commit comments

Comments
 (0)