Skip to content

Commit 0e5b72b

Browse files
committed
fix: print correct warning based on OS
1 parent 4da67f8 commit 0e5b72b

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

bin/vproxy/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"path/filepath"
99
"regexp"
10+
"runtime"
1011
"strings"
1112
"time"
1213

@@ -214,7 +215,7 @@ func createCAROOT() error {
214215
fmt.Printf("creating new CA at %s\n", path)
215216
}
216217

217-
fmt.Printf("\n >> NOTE: you may be prompted to enter your sudo password <<\n\n")
218+
warnPW()
218219

219220
err := os.MkdirAll(path, 0755)
220221
if err != nil {
@@ -235,6 +236,14 @@ func createCAROOT() error {
235236
return nil
236237
}
237238

239+
func warnPW() {
240+
sudo := "sudo"
241+
if runtime.GOOS == "windows" {
242+
sudo = "admin"
243+
}
244+
fmt.Printf("\n >> NOTE: you may be prompted to enter your %s password <<\n\n", sudo)
245+
}
246+
238247
func uninstallCAROOT() error {
239248
path := vproxy.CARootPath()
240249
os.Setenv("CAROOT", path)
@@ -244,7 +253,7 @@ func uninstallCAROOT() error {
244253
return nil
245254
}
246255

247-
fmt.Printf("\n >> NOTE: you may be prompted to enter your sudo password <<\n\n")
256+
warnPW()
248257

249258
truststore.Print = true
250259
err := vproxy.InitTrustStore()

0 commit comments

Comments
 (0)