(task: (args: any) => Promise<any>)
| 17 | } |
| 18 | |
| 19 | export function wrap(task: (args: any) => Promise<any>) { |
| 20 | return (args: any) => { |
| 21 | checkIsOutdated().catch((e: any) => log.warn({ error: e }, "cannot check updates")) |
| 22 | return loadEnv(path.join(process.cwd(), "electron-builder.env")) |
| 23 | .then(() => task(args)) |
| 24 | .catch(error => { |
| 25 | process.exitCode = 1 |
| 26 | // https://github.com/electron-userland/electron-builder/issues/2940 |
| 27 | process.on("exit", () => (process.exitCode = 1)) |
| 28 | if (error instanceof InvalidConfigurationError) { |
| 29 | log.error(null, error.message) |
| 30 | } else if (!(error instanceof ExecError) || !error.alreadyLogged) { |
| 31 | log.error({ failedTask: task.name, stackTrace: error.stack }, error.message) |
| 32 | } |
| 33 | }) |
| 34 | } |
| 35 | } |
no test coverage detected