From 117369aa732cdb49eea7d13bc2f581c6cab9388f Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Thu, 15 Feb 2024 14:58:29 -0800 Subject: [PATCH] Exit if we detect another copy of Ollama running --- app/lifecycle/lifecycle.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/lifecycle/lifecycle.go b/app/lifecycle/lifecycle.go index 1fa9c7a8..521ed74a 100644 --- a/app/lifecycle/lifecycle.go +++ b/app/lifecycle/lifecycle.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "log/slog" + "os" "github.com/jmorganca/ollama/app/store" "github.com/jmorganca/ollama/app/tray" @@ -58,8 +59,8 @@ func Run() { } if IsServerRunning(ctx) { - slog.Debug("XXX detected server already running") - // TODO - should we fail fast, try to kill it, or just ignore? + slog.Info("Detected another instance of ollama running, exiting") + os.Exit(1) } else { done, err = SpawnServer(ctx, CLIName) if err != nil {