MCPcopy Create free account
hub / github.com/electron-userland/electron-builder / wrap

Function wrap

packages/electron-builder/src/cli/cli-util.ts:19–35  ·  view source on GitHub ↗
(task: (args: any) => Promise<any>)

Source from the content-addressed store, hash-verified

17}
18
19export 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}

Callers 2

cli.tsFile · 0.90
cliTest.tsFile · 0.90

Calls 5

loadEnvFunction · 0.90
checkIsOutdatedFunction · 0.85
warnMethod · 0.65
onMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected