Skip to content

Commit

Permalink
refactor: input as out to match executeCommand
Browse files Browse the repository at this point in the history
Also prints new line after error status.
  • Loading branch information
AlejandroSuero committed Sep 8, 2024
1 parent ce901c1 commit 001b55f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ func main() {

// Copy the pty output to buffer
if config.Execute != "" {
input, err = executeCommand(config)
out, err := executeCommand(config)
if err != nil {
if input != "" {
if out != "" {
// show the full error message output
err = fmt.Errorf("%w %s", err, input)
err = fmt.Errorf("%w\n%s", err, out)
}
printErrorFatal("Something went wrong", err)
}
if input == "" {
if out == "" {
printErrorFatal("Something went wrong", errors.New("no command output"))
}
}
Expand Down

0 comments on commit 001b55f

Please sign in to comment.