(responses: ReadonlyArray<ExecResult>)
| 30 | } |
| 31 | |
| 32 | function makeStubExec(responses: ReadonlyArray<ExecResult>) { |
| 33 | const calls: StubCall[] = []; |
| 34 | let i = 0; |
| 35 | const execSystemctl = async ( |
| 36 | args: readonly string[], |
| 37 | options?: ExecOptions, |
| 38 | ): Promise<ExecResult> => { |
| 39 | calls.push({ args, options }); |
| 40 | const next = responses[i] ?? { stdout: '', stderr: '', code: 0 }; |
| 41 | i += 1; |
| 42 | return next; |
| 43 | }; |
| 44 | return { execSystemctl, calls } as const; |
| 45 | } |
| 46 | |
| 47 | function makeDeps( |
| 48 | responses: ReadonlyArray<ExecResult>, |