refact: Replace dangerous exec.Command
gg582 committed
May 8, 2026 at 21:48 UTC
5365f04ed560a071ad1875a8b3ec79a1282773e2
1 file changed
+3
-3
cmd/portal-tunnel/agent/dashboard.go
+3
-3
@@ -1099,11 +1099,11 @@ func openDashboardURL(rawURL string) error {
1099
var cmd *exec.Cmd
1100
switch runtime.GOOS {
1101
case "windows":
1102
- cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", rawURL)
1102
+ cmd = exec.CommandContext(ctx, "rundll32", "url.dll,FileProtocolHandler", rawURL)
1103
case "darwin":
1104
- cmd = exec.Command("open", rawURL)
1104
+ cmd = exec.CommandContext(ctx, "open", rawURL)
1105
default:
1106
- cmd = exec.Command("xdg-open", rawURL)
1106
+ cmd = exec.CommandContext(ctx, "xdg-open", rawURL)
1107
}
1108
if err := cmd.Start(); err != nil {
1109
return err