(cmd, options = {})
| 85 | }, |
| 86 | |
| 87 | spawn(cmd, options = {}) { |
| 88 | const [command, ...args] = cmd; |
| 89 | const stdio = options.stdio || ['pipe', 'pipe', 'pipe']; |
| 90 | const proc = spawn(command, args, { |
| 91 | stdio, |
| 92 | env: options.env, |
| 93 | cwd: options.cwd, |
| 94 | }); |
| 95 | |
| 96 | return { |
| 97 | pid: proc.pid, |
| 98 | stdout: proc.stdout, |
| 99 | stderr: proc.stderr, |
| 100 | stdin: proc.stdin, |
| 101 | unref() { proc.unref(); }, |
| 102 | kill(signal) { proc.kill(signal); }, |
| 103 | }; |
| 104 | }, |
| 105 | |
| 106 | sleep(ms) { |
| 107 | return new Promise((resolve) => setTimeout(resolve, ms)); |
no outgoing calls