Kill llama-server during Windows cleanup (#16458)
Windows installer and app cleanup could leave llama-server.exe running when ollama.exe was killed directly, so cleanup now includes llama-server.exe and taskkill /T.
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#define MyAppPublisher "Ollama"
|
#define MyAppPublisher "Ollama"
|
||||||
#define MyAppURL "https://ollama.com/"
|
#define MyAppURL "https://ollama.com/"
|
||||||
#define MyAppExeName "ollama app.exe"
|
#define MyAppExeName "ollama app.exe"
|
||||||
|
#define LlamaServerExeName "llama-server.exe"
|
||||||
#define MyIcon ".\assets\app.ico"
|
#define MyIcon ".\assets\app.ico"
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
@@ -126,6 +127,7 @@ Filename: "{cmd}"; Parameters: "/C set PATH={app};%PATH% & ""{app}\{#MyAppExeNam
|
|||||||
; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ollama.exe /f /t"; Flags: runhidden
|
; Filename: "{cmd}"; Parameters: "/C ""taskkill /im ollama.exe /f /t"; Flags: runhidden
|
||||||
Filename: "taskkill"; Parameters: "/im ""{#MyAppExeName}"" /f /t"; Flags: runhidden
|
Filename: "taskkill"; Parameters: "/im ""{#MyAppExeName}"" /f /t"; Flags: runhidden
|
||||||
Filename: "taskkill"; Parameters: "/im ""ollama.exe"" /f /t"; Flags: runhidden
|
Filename: "taskkill"; Parameters: "/im ""ollama.exe"" /f /t"; Flags: runhidden
|
||||||
|
Filename: "taskkill"; Parameters: "/im ""{#LlamaServerExeName}"" /f /t"; Flags: runhidden
|
||||||
; HACK! need to give the server and app enough time to exit
|
; HACK! need to give the server and app enough time to exit
|
||||||
; TODO - convert this to a Pascal code script so it waits until they're no longer running, then completes
|
; TODO - convert this to a Pascal code script so it waits until they're no longer running, then completes
|
||||||
Filename: "{cmd}"; Parameters: "/c timeout 5"; Flags: runhidden
|
Filename: "{cmd}"; Parameters: "/c timeout 5"; Flags: runhidden
|
||||||
@@ -325,5 +327,8 @@ procedure TaskKill(FileName: String);
|
|||||||
var
|
var
|
||||||
ResultCode: Integer;
|
ResultCode: Integer;
|
||||||
begin
|
begin
|
||||||
Exec('taskkill.exe', '/f /im ' + '"' + FileName + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
Exec('taskkill.exe', '/f /t /im ' + '"' + FileName + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||||
|
if FileName <> '{#LlamaServerExeName}' then begin
|
||||||
|
Exec('taskkill.exe', '/f /t /im "{#LlamaServerExeName}"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ func reapServers() error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("taskkill", "/F", "/PID", pidStr)
|
cmd := exec.Command("taskkill", "/F", "/T", "/PID", pidStr)
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
slog.Warn("failed to kill ollama process", "pid", pid, "err", err)
|
slog.Warn("failed to kill ollama process", "pid", pid, "err", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user