fix: merge os.Environ() with custom env in NewStdioTransport

This commit is contained in:
root
2026-07-21 12:45:26 +08:00
parent cfb4b72587
commit 54fa2ca93d

View File

@ -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()