(fn: () => Promise<unknown>)
| 9 | * Any uncaught error or promise rejection will be printed out in the console. |
| 10 | */ |
| 11 | export const runAndHandleErrors = (fn: () => Promise<unknown>) => { |
| 12 | const goFn = goSync(() => |
| 13 | fn() |
| 14 | .then(() => process.exit(0)) |
| 15 | .catch((error) => { |
| 16 | cliPrint.error(error); |
| 17 | process.exit(1); |
| 18 | }) |
| 19 | ); |
| 20 | if (!goFn.success) { |
| 21 | cliPrint.error('' + goFn.error); |
| 22 | process.exit(1); |
| 23 | } |
| 24 | }; |
| 25 | |
| 26 | /** |
| 27 | * Run the command passed as an argument in the current shell and stream the output of the command in the CLI. |
no outgoing calls
no test coverage detected