(distro *wsl.Distro, cmdSpec CommandSpec)
| 40 | } |
| 41 | |
| 42 | func MakeWSLProcessController(distro *wsl.Distro, cmdSpec CommandSpec) (*WSLProcessController, error) { |
| 43 | fullCmd, err := BuildShellCommand(cmdSpec) |
| 44 | if err != nil { |
| 45 | return nil, fmt.Errorf("failed to build shell command: %w", err) |
| 46 | } |
| 47 | |
| 48 | cmd := distro.WslCommand(context.Background(), fullCmd) |
| 49 | if cmd == nil { |
| 50 | return nil, fmt.Errorf("failed to create WSL command") |
| 51 | } |
| 52 | |
| 53 | return &WSLProcessController{ |
| 54 | distro: distro, |
| 55 | cmd: cmd, |
| 56 | lock: &sync.Mutex{}, |
| 57 | once: &sync.Once{}, |
| 58 | cmdSpec: cmdSpec, |
| 59 | }, nil |
| 60 | } |
| 61 | |
| 62 | func (w *WSLProcessController) Start() error { |
| 63 | w.lock.Lock() |
no test coverage detected