Skip to content

Commit

Permalink
refactor: add safety check to cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Gągor committed Dec 19, 2024
1 parent b9239e6 commit c90eecf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"bytes"
"context"
"errors"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -53,6 +54,9 @@ func (c Cmd) PostInfo(msg string) Cmd {
}

func (c Cmd) Run(ctx context.Context) (string, error) {
if c.cmd == "" {
return "", errors.New("command not set")
}
if c.preText != "" {
log.Info().Msg(c.preText)
}
Expand Down

0 comments on commit c90eecf

Please sign in to comment.