Enabling micro run for subfolders (#1510)
* Enabling micro run for subfolders * Use source instead of os.Args[2] * Works now * PR comments * WorkDir -> Dir
This commit is contained in:
parent
29cccd0b4a
commit
77f0abb0ba
@ -15,13 +15,17 @@ import (
|
|||||||
|
|
||||||
func (p *Process) Exec(exe *process.Executable) error {
|
func (p *Process) Exec(exe *process.Executable) error {
|
||||||
cmd := exec.Command(exe.Package.Path)
|
cmd := exec.Command(exe.Package.Path)
|
||||||
|
cmd.Dir = exe.Dir
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Process) Fork(exe *process.Executable) (*process.PID, error) {
|
func (p *Process) Fork(exe *process.Executable) (*process.PID, error) {
|
||||||
// create command
|
// create command
|
||||||
cmd := exec.Command(exe.Package.Path, exe.Args...)
|
cmd := exec.Command(exe.Package.Path, exe.Args...)
|
||||||
|
|
||||||
|
cmd.Dir = exe.Dir
|
||||||
// set env vars
|
// set env vars
|
||||||
|
cmd.Env = append(cmd.Env, os.Environ()...)
|
||||||
cmd.Env = append(cmd.Env, exe.Env...)
|
cmd.Env = append(cmd.Env, exe.Env...)
|
||||||
|
|
||||||
// create process group
|
// create process group
|
||||||
|
@ -26,6 +26,8 @@ type Executable struct {
|
|||||||
Env []string
|
Env []string
|
||||||
// Args to pass
|
// Args to pass
|
||||||
Args []string
|
Args []string
|
||||||
|
// Initial working directory
|
||||||
|
Dir string
|
||||||
}
|
}
|
||||||
|
|
||||||
// PID is the running process
|
// PID is the running process
|
||||||
|
@ -55,6 +55,7 @@ func newService(s *Service, c CreateOptions) *service {
|
|||||||
},
|
},
|
||||||
Env: c.Env,
|
Env: c.Env,
|
||||||
Args: args,
|
Args: args,
|
||||||
|
Dir: s.Source,
|
||||||
},
|
},
|
||||||
closed: make(chan bool),
|
closed: make(chan bool),
|
||||||
output: c.Output,
|
output: c.Output,
|
||||||
|
Loading…
Reference in New Issue
Block a user