()
| 23 | } |
| 24 | |
| 25 | func (c *CmdIO) String() string { |
| 26 | if c.Cmd == nil { |
| 27 | return "<nil>" |
| 28 | } |
| 29 | str := "" |
| 30 | if c.Cmd.ProcessState != nil { |
| 31 | str = c.Cmd.ProcessState.String() |
| 32 | } else if c.Cmd.Process != nil { |
| 33 | str = fmt.Sprintf("%d ", c.Cmd.Process.Pid) |
| 34 | } else { |
| 35 | str = "no process info" |
| 36 | } |
| 37 | str += " " + c.Cmd.String() |
| 38 | return str |
| 39 | } |
| 40 | |
| 41 | // NewCmdIO returns a new [CmdIO] initialized with StdIO settings from given Config |
| 42 | func NewCmdIO(c *Config) *CmdIO { |