diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go index d314ceb0..c8d9ed95 100644 --- a/pkg/cmd/run.go +++ b/pkg/cmd/run.go @@ -133,8 +133,8 @@ func init() { runCmd.Flags().StringP("config", "c", "", "enclave config (e.g. dev)") runCmd.Flags().String("fallback", "", "write secrets to this file after connecting to Doppler. secrets will be read from this file if future connection attempts are unsuccessful.") - runCmd.Flags().Bool("fallback-readonly", false, "do not update or modify the fallback file") - runCmd.Flags().Bool("fallback-only", false, "do not request secrets from Doppler. all secrets will be read directly from the fallback file") + runCmd.Flags().Bool("fallback-readonly", false, "do not update or modify the fallback file. [requires --fallback]") + runCmd.Flags().Bool("fallback-only", false, "do not request secrets from Doppler. all secrets will be read directly from the fallback file. [requires --fallback]") rootCmd.AddCommand(runCmd) } diff --git a/pkg/utils/util.go b/pkg/utils/util.go index a312202b..2da0745a 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -21,6 +21,7 @@ import ( "path/filepath" "runtime" "strconv" + "strings" "time" "github.com/AlecAivazis/survey/v2" @@ -67,7 +68,12 @@ func Cwd() string { // RunCommand runs the specified command func RunCommand(command []string, env []string) (int, error) { - cmd := exec.Command(command[0], command[1:]...) + shell := [2]string{"sh", "-c"} + if IsWindows() { + shell = [2]string{"cmd", "/C"} + } + + cmd := exec.Command(shell[0], shell[1], strings.Join(command, " ")) cmd.Env = env cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout @@ -215,3 +221,7 @@ func HostArch() string { return arch } + +func IsWindows() bool { + return runtime.GOOS == "windows" +}