Skip to content

Commit

Permalink
Moved cmdOperators handling from RunCmd to StartCmd (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfialkowski committed Mar 17, 2023
1 parent f83b3c8 commit 77099a8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions icmd/command.go
Expand Up @@ -208,10 +208,7 @@ func Command(command string, args ...string) Cmd {

// RunCmd runs a command and returns a Result
func RunCmd(cmd Cmd, cmdOperators ...CmdOp) *Result {
for _, op := range cmdOperators {
op(&cmd)
}
result := StartCmd(cmd)
result := StartCmd(cmd, cmdOperators...)
if result.Error != nil {
return result
}
Expand All @@ -224,7 +221,10 @@ func RunCommand(command string, args ...string) *Result {
}

// StartCmd starts a command, but doesn't wait for it to finish
func StartCmd(cmd Cmd) *Result {
func StartCmd(cmd Cmd, cmdOperators ...CmdOp) *Result {
for _, op := range cmdOperators {
op(&cmd)
}
result := buildCmd(cmd)
if result.Error != nil {
return result
Expand Down

0 comments on commit 77099a8

Please sign in to comment.