mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-22 01:48:11 +00:00
fix: merge os.Environ() with custom env in NewStdioTransport
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -22,7 +23,7 @@ type StdioTransport struct {
|
|||||||
func NewStdioTransport(command string, args []string, env []string) (*StdioTransport, error) {
|
func NewStdioTransport(command string, args []string, env []string) (*StdioTransport, error) {
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
if len(env) > 0 {
|
if len(env) > 0 {
|
||||||
cmd.Env = env
|
cmd.Env = append(os.Environ(), env...)
|
||||||
}
|
}
|
||||||
|
|
||||||
stdin, err := cmd.StdinPipe()
|
stdin, err := cmd.StdinPipe()
|
||||||
|
|||||||
Reference in New Issue
Block a user