New returns an instantiated daemon.
(ctx context.Context, log slog.Logger, cmd string, args ...string)
| 36 | |
| 37 | // New returns an instantiated daemon. |
| 38 | func New(ctx context.Context, log slog.Logger, cmd string, args ...string) *Process { |
| 39 | ctx, cancel := context.WithCancel(ctx) |
| 40 | return &Process{ |
| 41 | ctx: ctx, |
| 42 | cancel: cancel, |
| 43 | waitCh: make(chan error, 1), |
| 44 | cmd: xunix.GetExecer(ctx).CommandContext(ctx, cmd, args...), |
| 45 | log: log.Named(cmd), |
| 46 | userKilled: i64ptr(0), |
| 47 | binName: cmd, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | // Start starts the daemon. It functions akin to ox/exec.Command.Start(). |
| 52 | func (d *Process) Start() error { |
no test coverage detected