func (container *container) Run(processSpec garden.ProcessSpec, processIO garden.ProcessIO) (garden.Process, error) { wsUri := container.client.RunURL(container.Handle()) ws, _, err := websocket.DefaultDialer.Dial(wsUri, nil) if err != nil { return nil, err } websocket.WriteJSON(ws, ProcessStreamEvent{ MessageType: "run", ApiProcessSpec: processSpec, }) proc := process.NewDotNetProcess(container.Handle(), container.client) pidChannel := make(chan uint32) streamWebsocketIOToContainerizer(ws, processIO) go func() { exitCode, err := streamWebsocketIOFromContainerizer(ws, pidChannel, processIO) proc.StreamOpen <- process.DotNetProcessExitStatus{exitCode, err} close(proc.StreamOpen) }() proc.Pid = <-pidChannel return proc, nil }
func (container *container) Attach(uint32, garden.ProcessIO) (garden.Process, error) { return process.NewDotNetProcess(container.Handle(), container.client), nil }