(
s: string,
opts: { silent: boolean } = { silent: !DEBUG },
cb?: any
)
| 38 | } |
| 39 | |
| 40 | export function exec( |
| 41 | s: string, |
| 42 | opts: { silent: boolean } = { silent: !DEBUG }, |
| 43 | cb?: any |
| 44 | ): { stdout: string; code: number } { |
| 45 | debug(s); |
| 46 | let result = shell.exec(s, opts, cb); |
| 47 | |
| 48 | if (result.code !== 0) { |
| 49 | console.error(result.stdout); |
| 50 | console.error(result.stderr); |
| 51 | failWith("Command failed", { |
| 52 | command: s, |
| 53 | code: result.code |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | return result; |
| 58 | } |
| 59 | |
| 60 | async function time<T>(work: () => Promise<T>): Promise<[T, number]> { |
| 61 | let start = +new Date(); |