containerd/execution/executors/oci/process.go
Kenfe-Mickael Laventure c857213b4c move work on execution service
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-12-05 14:15:03 -08:00

38 lines
600 B
Go

package oci
import (
"os"
"syscall"
"github.com/docker/containerd/execution"
)
func newProcess(pid int) (execution.Process, error) {
proc, err := os.FindProcess(pid)
if err != nil {
return nil, err
}
return &process{
proc: proc,
}, nil
}
type process struct {
proc *os.Process
}
func (p *process) Pid() int {
return p.proc.Pid
}
func (p *process) Wait() (uint32, error) {
state, err := p.proc.Wait()
if err != nil {
return 0, nil
}
return uint32(state.Sys().(syscall.WaitStatus).ExitStatus()), nil
}
func (p *process) Signal(s os.Signal) error {
return p.proc.Signal(s)
}