expose Dir from pmuxprox.Config

This commit is contained in:
Brian Picciano 2022-01-22 20:39:34 -07:00
parent 3057f470d4
commit 530c868949

View File

@ -25,6 +25,10 @@ type Config struct {
// Env describes the environment variables to set on the process. // Env describes the environment variables to set on the process.
Env map[string]string `yaml:"env"` Env map[string]string `yaml:"env"`
// Dir is the directory the process will be run in. If not set then the
// process is run in the same directory as this parent process.
Dir string
// MinWait and MaxWait are the minimum and maximum amount of time between // MinWait and MaxWait are the minimum and maximum amount of time between
// restarts that RunProcess will wait. // restarts that RunProcess will wait.
// //
@ -92,6 +96,7 @@ func RunProcessOnce(ctx context.Context, logger Logger, cfg Config) error {
} }
cmd := exec.Command(cfg.Cmd, cfg.Args...) cmd := exec.Command(cfg.Cmd, cfg.Args...)
cmd.Dir = cfg.Dir
cmd.Env = make([]string, 0, len(cfg.Env)) cmd.Env = make([]string, 0, len(cfg.Env))
for k, v := range cfg.Env { for k, v := range cfg.Env {