mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Merge pull request #48 from lordmathis/fix/command-environment
fix: Pass host environment to instances
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -384,7 +385,11 @@ func (i *Process) buildCommand() (*exec.Cmd, error) {
|
|||||||
|
|
||||||
// Create the exec.Cmd
|
// Create the exec.Cmd
|
||||||
cmd := exec.CommandContext(i.ctx, command, args...)
|
cmd := exec.CommandContext(i.ctx, command, args...)
|
||||||
cmd.Env = []string{}
|
|
||||||
|
// Start with host environment variables
|
||||||
|
cmd.Env = os.Environ()
|
||||||
|
|
||||||
|
// Add/override with backend-specific environment variables
|
||||||
for k, v := range env {
|
for k, v := range env {
|
||||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
|
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user