Skip to content

Commit 77099a8

Browse files
Moved cmdOperators handling from RunCmd to StartCmd (#259)
1 parent f83b3c8 commit 77099a8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

icmd/command.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,7 @@ func Command(command string, args ...string) Cmd {
208208

209209
// RunCmd runs a command and returns a Result
210210
func RunCmd(cmd Cmd, cmdOperators ...CmdOp) *Result {
211-
for _, op := range cmdOperators {
212-
op(&cmd)
213-
}
214-
result := StartCmd(cmd)
211+
result := StartCmd(cmd, cmdOperators...)
215212
if result.Error != nil {
216213
return result
217214
}
@@ -224,7 +221,10 @@ func RunCommand(command string, args ...string) *Result {
224221
}
225222

226223
// StartCmd starts a command, but doesn't wait for it to finish
227-
func StartCmd(cmd Cmd) *Result {
224+
func StartCmd(cmd Cmd, cmdOperators ...CmdOp) *Result {
225+
for _, op := range cmdOperators {
226+
op(&cmd)
227+
}
228228
result := buildCmd(cmd)
229229
if result.Error != nil {
230230
return result

0 commit comments

Comments
 (0)