|
5 | 5 | "fmt" |
6 | 6 | "os" |
7 | 7 | "os/exec" |
8 | | - "strings" |
9 | 8 |
|
10 | 9 | "github.com/spf13/cobra" |
11 | 10 | "github.com/spf13/viper" |
@@ -96,33 +95,33 @@ func runE(client resources.Client) func(cmd *cobra.Command, args []string) error |
96 | 95 | return fmt.Errorf("Node.js is required to upload sourcemaps: %v", err) |
97 | 96 | } |
98 | 97 |
|
99 | | - args := []string{npmPackage, "upload", "--apiKey", apiKey} |
| 98 | + npxArgs := []string{npmPackage, "upload", "--apiKey", apiKey} |
100 | 99 |
|
101 | 100 | if appVersion != "" { |
102 | | - args = append(args, "--appVersion", appVersion) |
| 101 | + npxArgs = append(npxArgs, "--appVersion", appVersion) |
103 | 102 | } |
104 | 103 |
|
105 | 104 | if path != defaultPath { |
106 | | - args = append(args, "--path", path) |
| 105 | + npxArgs = append(npxArgs, "--path", path) |
107 | 106 | } |
108 | 107 |
|
109 | 108 | if basePath != "" { |
110 | | - args = append(args, "--basePath", basePath) |
| 109 | + npxArgs = append(npxArgs, "--basePath", basePath) |
111 | 110 | } |
112 | 111 |
|
113 | 112 | if backendUrl != defaultBackendUrl { |
114 | | - args = append(args, "--backendUrl", backendUrl) |
| 113 | + npxArgs = append(npxArgs, "--backendUrl", backendUrl) |
115 | 114 | } |
116 | 115 |
|
117 | 116 | fmt.Printf("Starting to upload source maps from %s using %s\n", path, npmPackage) |
118 | 117 |
|
119 | | - cmd := exec.Command("npx", args...) |
| 118 | + execCmd := exec.Command("npx", npxArgs...) |
120 | 119 | var stdout, stderr bytes.Buffer |
121 | | - cmd.Stdout = &stdout |
122 | | - cmd.Stderr = &stderr |
123 | | - cmd.Env = os.Environ() |
| 120 | + execCmd.Stdout = &stdout |
| 121 | + execCmd.Stderr = &stderr |
| 122 | + execCmd.Env = os.Environ() |
124 | 123 |
|
125 | | - err := cmd.Run() |
| 124 | + err := execCmd.Run() |
126 | 125 | fmt.Print(stdout.String()) |
127 | 126 |
|
128 | 127 | if err != nil { |
|
0 commit comments