From a8ed68bd9383ffec346fd1b3cf60d94c032bbec8 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Fri, 6 Jun 2025 14:06:29 -0700 Subject: [PATCH] launch app hidden (#10962) When starting the app in the background, start it hidden. --- cmd/start_darwin.go | 2 +- cmd/start_windows.go | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/start_darwin.go b/cmd/start_darwin.go index 1a9a1ae8..3cb726ea 100644 --- a/cmd/start_darwin.go +++ b/cmd/start_darwin.go @@ -23,7 +23,7 @@ func startApp(ctx context.Context, client *api.Client) error { return errors.New("could not find ollama app") } path := strings.Split(link, "Ollama.app") - if err := exec.Command("/usr/bin/open", "-a", path[0]+"Ollama.app").Run(); err != nil { + if err := exec.Command("/usr/bin/open", "-j", "-a", path[0]+"Ollama.app").Run(); err != nil { return err } return waitForServer(ctx, client) diff --git a/cmd/start_windows.go b/cmd/start_windows.go index 1b648d9d..635b5077 100644 --- a/cmd/start_windows.go +++ b/cmd/start_windows.go @@ -45,14 +45,11 @@ func startApp(ctx context.Context, client *api.Client) error { } } } - // log.Printf("XXX attempting to start app %s", appExe) cmd_path := "c:\\Windows\\system32\\cmd.exe" - cmd := exec.Command(cmd_path, "/c", appExe) - // TODO - these hide flags aren't working - still pops up a command window for some reason + cmd := exec.Command(cmd_path, "/c", appExe, "hidden") cmd.SysProcAttr = &syscall.SysProcAttr{CreationFlags: 0x08000000, HideWindow: true} - // TODO this didn't help either... cmd.Stdin = strings.NewReader("") cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr