Skip to content

Commit 526aa97

Browse files
committed
Materialize the inherited env before the command modifier
A nil Env means inherit the parent, but a modifier that appends to it would start from an empty slice and drop the parent environment (PATH, SYSTEMROOT and such). Set it to os.Environ() first when nil.
1 parent 6cf15b5 commit 526aa97

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

pkg/inference/backends/runner.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ func RunBackend(ctx context.Context, config RunnerConfig) error {
120120
command.Env = append(os.Environ(), config.Env...)
121121
}
122122
if config.CommandModifier != nil {
123+
// Materialize the inherited environment first: a nil Env means
124+
// "inherit the parent", but a modifier that appends to it would
125+
// otherwise start from an empty slice and drop the parent env.
126+
if command.Env == nil {
127+
command.Env = os.Environ()
128+
}
123129
config.CommandModifier(command)
124130
}
125131
},

0 commit comments

Comments
 (0)