diff --git a/pkg/commands/os.go b/pkg/commands/os.go index 9ccd10eb6..29ec2c654 100644 --- a/pkg/commands/os.go +++ b/pkg/commands/os.go @@ -4,7 +4,6 @@ import ( "errors" "os" "os/exec" - "runtime" "strings" "github.com/davecgh/go-spew/spew" @@ -74,25 +73,6 @@ func sanitisedCommandOutput(output []byte, err error) (string, error) { return outputString, nil } -func getPlatform() *Platform { - switch runtime.GOOS { - case "windows": - return &Platform{ - os: "windows", - shell: "cmd", - shellArg: "/c", - escapedQuote: "\\\"", - } - default: - return &Platform{ - os: runtime.GOOS, - shell: "bash", - shellArg: "-c", - escapedQuote: "\"", - } - } -} - // GetOpenCommand get open command func (c *OSCommand) GetOpenCommand() (string, string, error) { //NextStep open equivalents: xdg-open (linux), cygstart (cygwin), open (OSX) diff --git a/pkg/commands/os_default_platform.go b/pkg/commands/os_default_platform.go new file mode 100644 index 000000000..f6ac1b515 --- /dev/null +++ b/pkg/commands/os_default_platform.go @@ -0,0 +1,16 @@ +// +build !windows + +package commands + +import ( + "runtime" +) + +func getPlatform() *Platform { + return &Platform{ + os: runtime.GOOS, + shell: "bash", + shellArg: "-c", + escapedQuote: "\"", + } +} diff --git a/pkg/commands/os_windows.go b/pkg/commands/os_windows.go new file mode 100644 index 000000000..28dd7a982 --- /dev/null +++ b/pkg/commands/os_windows.go @@ -0,0 +1,10 @@ +package commands + +func getPlatform() *Platform { + return &Platform{ + os: "windows", + shell: "cmd", + shellArg: "/c", + escapedQuote: "\\\"", + } +}