Skip to content

Commit 92d6455

Browse files
committed
should help the linter and better practise?
1 parent b96a881 commit 92d6455

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

internal/shell_executable/shell_executable.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,7 @@ func (b *ShellExecutable) ReadUntilConditionOrTimeout(condition func() bool, tim
114114
}
115115

116116
// Then return error message
117-
if errors.Is(err, io.EOF) || errors.Is(err, syscall.EIO) {
118-
return ErrProgramExited
119-
}
120-
if errors.Is(err, condition_reader.ErrConditionNotMet) {
121-
return fmt.Errorf("the 'exit' command should terminate your shell, but your shell is still running")
122-
}
123-
return err
117+
return wrapReaderError(err)
124118
}
125119
return nil
126120
}
@@ -213,7 +207,9 @@ func wrapReaderError(readerErr error) error {
213207
if errors.Is(readerErr, io.EOF) || errors.Is(readerErr, syscall.EIO) {
214208
return ErrProgramExited
215209
}
216-
210+
if errors.Is(readerErr, condition_reader.ErrConditionNotMet) {
211+
return fmt.Errorf("the 'exit' command should terminate your shell, but your shell is still running")
212+
}
217213
return readerErr
218214
}
219215

0 commit comments

Comments
 (0)