fix: node env path loading

This commit is contained in:
engigu
2026-03-23 20:53:52 +08:00
parent 31891cfaf3
commit 78b7232e38
3 changed files with 40 additions and 3 deletions
+12
View File
@@ -113,6 +113,18 @@ func ExecuteWithHooks(ctx context.Context, req Request, stdout, stderr io.Writer
execCtx, cancel := context.WithTimeout(ctx, time.Duration(timeout)*time.Minute)
defer cancel()
// 隐式且静默地获取包含 node 环境的全局路径,并注入环境变量 (带极速缓存)
if req.UseMise {
for _, lang := range req.Languages {
if lang["name"] == "node" {
if nodePath := utils.GetMiseNodePath(lang["version"]); nodePath != "" {
req.Envs = append(req.Envs, "NODE_PATH="+nodePath)
}
break
}
}
}
// 如果指定使用 mise,则预先构建好带 mise 的命令,这样 PreExecute 记录的就是完整命令
if req.UseMise {
req.Command = utils.BuildMiseCommand(req.Command, req.Languages)