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,CAAA;YAChD,IAAI,KAAK,YAAY,wCAAyB,EAAE,CAAC;gBAC/C,kBAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;YAChC,CAAC;iBAAM,IAAI,CAAC,CAAC,KAAK,YAAY,wBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;gBACjE,kBAAG,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;YAC9E,CAAC;QACH,CAAC,CAAC,CAAA;IACN,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { loadEnv } from \"app-builder-lib/out/util/config/load\"\nimport { ExecError, InvalidConfigurationError, log } from \"builder-util\"\nimport { isCI } from \"ci-info\"\nimport { readJson } from \"fs-extra\"\nimport * as path from \"path\"\n\nexport async function checkIsOutdated(): Promise<void> {\n  if (isCI || process.env.NO_UPDATE_NOTIFIER != null) {\n    return\n  }\n  const pkg = await readJson(path.join(__dirname, \"..\", \"..\", \"package.json\"))\n  if (pkg.version === \"0.0.0-semantic-release\") {\n    return\n  }\n  const UpdateNotifier = require(\"simple-update-notifier\")\n  await UpdateNotifier({ pkg })\n}\n\nexport function wrap(task: (args: any) => Promise<any>) {\n  return (args: any) => {\n    checkIsOutdated().catch((e: any) => log.warn({ error: e }, \"cannot check updates\"))\n    return loadEnv(path.join(process.cwd(), \"electron-builder.env\"))\n      .then(() => task(args))\n      .catch(error => {\n        process.exitCode = 1\n        // https://github.com/electron-userland/electron-builder/issues/2940\n        process.on(\"exit\", () => (process.exitCode = 1))\n        if (error instanceof InvalidConfigurationError) {\n          log.error(null, error.message)\n        } else if (!(error instanceof ExecError) || !error.alreadyLogged) {\n          log.error({ failedTask: task.name, stackTrace: error.stack }, error.message)\n        }\n      })\n  }\n}\n"]}