Support set environment for process manager
All checks were successful
release-nightly / build-docker (push) Successful in 1m10s

This commit is contained in:
LittleSheep 2023-12-16 21:12:45 +08:00
parent 47bc1c6aa1
commit 4942a8b7a2

View File

@ -8,11 +8,12 @@ import (
) )
type ProcessConfig struct { type ProcessConfig struct {
ID string `json:"id" yaml:"id"` ID string `json:"id" yaml:"id"`
Workdir string `json:"workdir" yaml:"workdir"` Workdir string `json:"workdir" yaml:"workdir"`
Command []string `json:"command" yaml:"command"` Command []string `json:"command" yaml:"command"`
Prepares [][]string `json:"prepares" yaml:"prepares"` Environment []string `json:"environment" yaml:"environment"`
Preheat bool `json:"preheat" yaml:"preheat"` Prepares [][]string `json:"prepares" yaml:"prepares"`
Preheat bool `json:"preheat" yaml:"preheat"`
Cmd *exec.Cmd `json:"-"` Cmd *exec.Cmd `json:"-"`
} }
@ -63,6 +64,7 @@ func (v *ProcessConfig) StartProcess() error {
v.Cmd = exec.Command(v.Command[0], v.Command[1:]...) v.Cmd = exec.Command(v.Command[0], v.Command[1:]...)
v.Cmd.Dir = filepath.Join(v.Workdir) v.Cmd.Dir = filepath.Join(v.Workdir)
v.Cmd.Env = append(v.Cmd.Env, v.Environment...)
return v.Cmd.Start() return v.Cmd.Start()
} }