bugfix: On Windows cmd.Run does not reliably wait
This commit is contained in:
parent
0f08f16a5f
commit
807c472815
|
@ -129,7 +129,8 @@ func StrSlice(sl []string, start int, end int) []string {
|
||||||
|
|
||||||
func OpenInDefaultApp(filename string, wait bool) error {
|
func OpenInDefaultApp(filename string, wait bool) error {
|
||||||
var cmd *exec.Cmd
|
var cmd *exec.Cmd
|
||||||
switch goos := runtime.GOOS; goos {
|
goos := runtime.GOOS
|
||||||
|
switch goos {
|
||||||
case "windows":
|
case "windows":
|
||||||
cmd = exec.Command(filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe"), "url.dll,FileProtocolHandler", filename)
|
cmd = exec.Command(filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe"), "url.dll,FileProtocolHandler", filename)
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
@ -138,7 +139,11 @@ func OpenInDefaultApp(filename string, wait bool) error {
|
||||||
cmd = exec.Command("xdg-open", filename)
|
cmd = exec.Command("xdg-open", filename)
|
||||||
}
|
}
|
||||||
if wait {
|
if wait {
|
||||||
return cmd.Run()
|
err := cmd.Run()
|
||||||
|
if goos == "windows" {
|
||||||
|
AskFor("Press Enter when you're done")
|
||||||
|
}
|
||||||
|
return err
|
||||||
} else {
|
} else {
|
||||||
return cmd.Start()
|
return cmd.Start()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user