mirror of
https://github.com/ollama/ollama.git
synced 2026-05-13 14:27:00 +00:00
Merge 34dd5c67e5 into 6bdb73073b
This commit is contained in:
commit
536e8450bd
1 changed files with 15 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ package main
|
|||
import "C"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -141,6 +142,20 @@ func installSymlink() {
|
|||
|
||||
// Check the users path first
|
||||
cmd, _ := exec.LookPath("ollama")
|
||||
if cmd == "" {
|
||||
// GUI apps don't inherit shell PATH from .zshrc/.bashrc,
|
||||
// so also check via the user's login shell
|
||||
shell := os.Getenv("SHELL")
|
||||
if shell == "" {
|
||||
shell = "/bin/zsh"
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
out, err := exec.CommandContext(ctx, shell, "-l", "-c", "command -v ollama").Output()
|
||||
if err == nil {
|
||||
cmd = strings.TrimSpace(string(out))
|
||||
}
|
||||
}
|
||||
if cmd != "" {
|
||||
resolved, err := os.Readlink(cmd)
|
||||
if err == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue