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 {
|
||||
var cmd *exec.Cmd
|
||||
switch goos := runtime.GOOS; goos {
|
||||
goos := runtime.GOOS
|
||||
switch goos {
|
||||
case "windows":
|
||||
cmd = exec.Command(filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe"), "url.dll,FileProtocolHandler", filename)
|
||||
case "darwin":
|
||||
|
@ -138,7 +139,11 @@ func OpenInDefaultApp(filename string, wait bool) error {
|
|||
cmd = exec.Command("xdg-open", filename)
|
||||
}
|
||||
if wait {
|
||||
return cmd.Run()
|
||||
err := cmd.Run()
|
||||
if goos == "windows" {
|
||||
AskFor("Press Enter when you're done")
|
||||
}
|
||||
return err
|
||||
} else {
|
||||
return cmd.Start()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user