update runtime to function
This commit is contained in:
		| @@ -19,10 +19,11 @@ func (p *Process) Exec(exe *process.Executable) error { | ||||
| } | ||||
|  | ||||
| func (p *Process) Fork(exe *process.Executable) (*process.PID, error) { | ||||
| 	cmd := exec.Command(exe.Binary.Path) | ||||
| 	if err := cmd.Start(); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 	// create command | ||||
| 	cmd := exec.Command(exe.Binary.Path, exe.Args...) | ||||
| 	// set env vars | ||||
| 	cmd.Env = append(cmd.Env, exe.Env...) | ||||
|  | ||||
| 	in, err := cmd.StdinPipe() | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| @@ -36,6 +37,11 @@ func (p *Process) Fork(exe *process.Executable) (*process.PID, error) { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	// start the process | ||||
| 	if err := cmd.Start(); err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | ||||
| 	return &process.PID{ | ||||
| 		ID:     fmt.Sprintf("%d", cmd.Process.Pid), | ||||
| 		Input:  in, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user