-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle "run" command in the skip/only setting
- Loading branch information
1 parent
ed10e37
commit f4d8b25
Showing
7 changed files
with
145 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package config | ||
|
||
import ( | ||
"os/exec" | ||
"strings" | ||
) | ||
|
||
type Exec interface { | ||
Cmd(commandLine string) bool | ||
} | ||
|
||
type osExec struct{} | ||
|
||
// NewOsExec returns an object that executes given commands in the OS. | ||
func NewOsExec() Exec { | ||
return &osExec{} | ||
} | ||
|
||
// Cmd runs plain string command. It checks only exit code and returns bool value. | ||
func (o *osExec) Cmd(commandLine string) bool { | ||
parts := strings.Fields(commandLine) | ||
|
||
if len(parts) == 0 { | ||
return false | ||
} | ||
|
||
cmdName := parts[0] | ||
cmdArgs := parts[1:] | ||
|
||
cmd := exec.Command(cmdName, cmdArgs...) | ||
err := cmd.Run() | ||
|
||
return err == nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters