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C,MAAA,GADwC;AAExC,MAAA,KAAK,EAAE,CAAC,QAAD,EAAW,MAAX,EAAmB,OAAO,CAAC,MAA3B;AAFiC,KAAA,EAGrC,YAHqC,CAAd,CAA5B;;AAKA,QAAI,oBAAoB,IAAI,IAA5B,EAAkC;AAChC,MAAA,oBAAoB,CAAC,YAAD,CAApB;AACD;;AACD,IAAA,aAAa,CAAC,OAAD,EAAU,YAAV,EAAwB,OAAxB,EAAiC,OAAjC,EAA0C,KAAK,IAAG;AAC7D,UAAI,KAAK,YAAY,SAAjB,IAA8B,KAAK,CAAC,QAAN,KAAmB,CAArD,EAAwD;AACtD,QAAA,KAAK,CAAC,aAAN,GAAsB,IAAtB;AACD;;AACD,MAAA,MAAM,CAAC,KAAD,CAAN;AACD,KALY,CAAb;AAMD,GA9BM,CAAP;AA+BD,C","sourcesContent":["import { path7za } from \"7zip-bin\"\nimport { appBuilderPath } from \"app-builder-bin\"\nimport { safeStringifyJson } from \"builder-util-runtime\"\nimport chalk from \"chalk\"\nimport { ChildProcess, execFile, ExecFileOptions, spawn as _spawn, SpawnOptions } from \"child_process\"\nimport { createHash } from \"crypto\"\nimport _debug from \"debug\"\nimport { safeDump } from \"js-yaml\"\nimport * as path from \"path\"\nimport \"source-map-support/register\"\nimport { debug, log } from \"./log\"\n\nexport { safeStringifyJson } from \"builder-util-runtime\"\nexport { TmpDir } from \"temp-file\"\nexport { log, debug } from \"./log\"\nexport { Arch, getArchCliNames, toLinuxArchString, getArchSuffix, ArchType, archFromString } from \"./arch\"\nexport { AsyncTaskManager } from \"./asyncTaskManager\"\nexport { DebugLogger } from \"./DebugLogger\"\n\nexport { copyFile } from \"./fs\"\nexport { asArray } from \"builder-util-runtime\"\n\nexport { deepAssign } from \"./deepAssign\"\n\nexport const debug7z = _debug(\"electron-builder:7z\")\n\nexport function serializeToYaml(object: any, skipInvalid = false, noRefs = false) {\n return safeDump(object, {\n lineWidth: 8000,\n skipInvalid,\n noRefs,\n })\n}\n\nexport function removePassword(input: string) {\n return input.replace(/(-String |-P |pass:| \\/p |-pass |--secretKey |--accessKey |-p )([^ ]+)/g, (match, p1, p2) => {\n if (p1.trim() === \"/p\" && p2.startsWith(\"\\\\\\\\Mac\\\\Host\\\\\\\\\")) {\n // appx /p\n return `${p1}${p2}`\n }\n return `${p1}${createHash(\"sha256\").update(p2).digest(\"hex\")} (sha256 hash)`\n })\n}\n\nfunction getProcessEnv(env: { [key: string]: string | undefined } | undefined | null): NodeJS.ProcessEnv | undefined {\n if (process.platform === \"win32\") {\n return env == null ? undefined : env\n }\n\n const finalEnv = {\n ...(env || process.env)\n }\n\n // without LC_CTYPE dpkg can returns encoded unicode symbols\n // set LC_CTYPE to avoid crash https://github.com/electron-userland/electron-builder/issues/503 Even \"en_DE.UTF-8\" leads to error.\n const locale = process.platform === \"linux\" ? (process.env.LANG || \"C.UTF-8\") : \"en_US.UTF-8\"\n finalEnv.LANG = locale\n finalEnv.LC_CTYPE = locale\n finalEnv.LC_ALL = locale\n return finalEnv\n}\n\nexport function exec(file: string, args?: Array<string> | null, options?: ExecFileOptions, isLogOutIfDebug = true): Promise<string> {\n if (log.isDebugEnabled) {\n const logFields: any = {\n file,\n args: args == null ? \"\" : removePassword(args.join(\" \")),\n }\n if (options != null) {\n if (options.cwd != null) {\n logFields.cwd = options.cwd\n }\n\n if (options.env != null) {\n const diffEnv = {...options.env}\n for (const name of Object.keys(process.env)) {\n if (process.env[name] === options.env[name]) {\n delete diffEnv[name]\n }\n }\n logFields.env = safeStringifyJson(diffEnv)\n }\n }\n\n log.debug(logFields, \"executing\")\n }\n\n return new Promise<string>((resolve, reject) => {\n execFile(file, args, {\n ...options,\n maxBuffer: 1000 * 1024 * 1024,\n env: getProcessEnv(options == null ? null : options.env),\n }, (error, stdout, stderr) => {\n if (error == null) {\n if (isLogOutIfDebug && log.isDebugEnabled) {\n const logFields: any = {\n file,\n }\n if (stdout.length > 0) {\n logFields.stdout = stdout\n }\n if (stderr.length > 0) {\n logFields.stderr = stderr\n }\n\n log.debug(logFields, \"executed\")\n }\n resolve(stdout.toString())\n }\n else {\n let message = chalk.red(removePassword(`Exit code: ${(error as any).code}. ${error.message}`))\n if (stdout.length !== 0) {\n if (file.endsWith(\"wine\")) {\n stdout = stdout.toString()\n }\n message += `\\n${chalk.yellow(stdout.toString())}`\n }\n if (stderr.length !== 0) {\n if (file.endsWith(\"wine\")) {\n stderr = stderr.toString()\n }\n message += `\\n${chalk.red(stderr.toString())}`\n }\n\n reject(new Error(message))\n }\n })\n })\n}\n\nexport interface ExtraSpawnOptions {\n isPipeInput?: boolean\n}\n\nfunction logSpawn(command: string, args: Array<string>, options: SpawnOptions) {\n // use general debug.enabled to log spawn, because it doesn't produce a lot of output (the only line), but important in any case\n if (!log.isDebugEnabled) {\n return\n }\n\n const argsString = removePassword(args.join(\" \"))\n const logFields: any = {\n command: command + \" \" + (command === \"docker\" ? argsString : removePassword(argsString)),\n }\n if (options != null && options.cwd != null) {\n logFields.cwd = options.cwd\n }\n log.debug(logFields, \"spawning\")\n}\n\nexport function doSpawn(command: string, args: Array<string>, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): ChildProcess {\n if (options == null) {\n options = {}\n }\n\n options.env = getProcessEnv(options.env)\n\n if (options.stdio == null) {\n const isDebugEnabled = debug.enabled\n // do not ignore stdout/stderr if not debug, because in this case we will read into buffer and print on error\n options.stdio = [extraOptions != null && extraOptions.isPipeInput ? \"pipe\" : \"ignore\", isDebugEnabled ? \"inherit\" : \"pipe\", isDebugEnabled ? \"inherit\" : \"pipe\"] as any\n }\n\n logSpawn(command, args, options)\n try {\n return _spawn(command, args, options)\n }\n catch (e) {\n throw new Error(`Cannot spawn ${command}: ${e.stack || e}`)\n }\n}\n\nexport function spawnAndWrite(command: string, args: Array<string>, data: string, options?: SpawnOptions) {\n const childProcess = doSpawn(command, args, options, {isPipeInput: true})\n const timeout = setTimeout(() => childProcess.kill(), 4 * 60 * 1000)\n return new Promise<any>((resolve, reject) => {\n handleProcess(\"close\", childProcess, command, () => {\n try {\n clearTimeout(timeout)\n }\n finally {\n resolve()\n }\n }, error => {\n try {\n clearTimeout(timeout)\n }\n finally {\n reject(error.stack || error.toString())\n }\n })\n\n childProcess.stdin!!.end(data)\n })\n}\n\nexport function spawn(command: string, args?: Array<string> | null, options?: SpawnOptions, extraOptions?: ExtraSpawnOptions): Promise<any> {\n return new Promise<any>((resolve, reject) => {\n handleProcess(\"close\", doSpawn(command, args || [], options, extraOptions), command, resolve, reject)\n })\n}\n\nfunction handleProcess(event: string, childProcess: ChildProcess, command: string, resolve: ((value?: any) => void) | null, reject: (reason?: any) => void) {\n childProcess.on(\"error\", reject)\n\n let out = \"\"\n if (childProcess.stdout != null) {\n childProcess.stdout.on(\"data\", (data: string) => {\n out += data\n })\n }\n\n let errorOut = \"\"\n if (childProcess.stderr != null) {\n childProcess.stderr.on(\"data\", (data: string) => {\n errorOut += data\n })\n }\n\n childProcess.once(event, (code: number) => {\n if (log.isDebugEnabled) {\n const fields: any = {\n command: path.basename(command),\n code,\n pid: childProcess.pid,\n }\n if (out.length > 0) {\n fields.out = out\n }\n log.debug(fields, \"exited\")\n }\n\n if (code === 0) {\n if (resolve != null) {\n resolve(out)\n }\n }\n else {\n reject(new ExecError(command, code, formatOut(out, \"Output\"), formatOut(errorOut, \"Error output\")))\n }\n })\n}\n\nfunction formatOut(text: string, title: string) {\n return text.length === 0 ? \"\" : `\\n${title}:\\n${text}`\n}\n\nexport class ExecError extends Error {\n alreadyLogged = false\n\n constructor(command: string, readonly exitCode: number, out: string, errorOut: string, code: string = \"ERR_ELECTRON_BUILDER_CANNOT_EXECUTE\") {\n super(`${command} exited with code ${code}${formatOut(out, \"Output\")}${formatOut(errorOut, \"Error output\")}`);\n\n (this as NodeJS.ErrnoException).code = code\n }\n}\n\nexport function use<T, R>(value: T | null, task: (it: T) => R): R | null {\n return value == null ? null : task(value)\n}\n\nexport function isEmptyOrSpaces(s: string | null | undefined): s is \"\" | null | undefined {\n return s == null || s.trim().length === 0\n}\n\nexport function isTokenCharValid(token: string) {\n return /^[\\w\\/=+-]+$/.test(token)\n}\n\nexport function addValue<K, T>(map: Map<K, Array<T>>, key: K, value: T) {\n const list = map.get(key)\n if (list == null) {\n map.set(key, [value])\n }\n else if (!list.includes(value)) {\n list.push(value)\n }\n}\n\nexport function replaceDefault(inList: Array<string> | null | undefined, defaultList: Array<string>): Array<string> {\n if (inList == null || (inList.length === 1 && inList[0] === \"default\")) {\n return defaultList\n }\n\n const index = inList.indexOf(\"default\")\n if (index >= 0) {\n const list = inList.slice(0, index)\n list.push(...defaultList)\n if (index !== (inList.length - 1)) {\n list.push(...inList.slice(index + 1))\n }\n inList = list\n }\n return inList\n}\n\nexport function getPlatformIconFileName(value: string | null | undefined, isMac: boolean) {\n if (value === undefined) {\n return undefined\n }\n if (value === null) {\n return null\n }\n\n if (!value.includes(\".\")) {\n return `${value}.${isMac ? \"icns\" : \"ico\"}`\n }\n\n return value.replace(isMac ? \".ico\" : \".icns\", isMac ? \".icns\" : \".ico\")\n}\n\nexport function isPullRequest() {\n // TRAVIS_PULL_REQUEST is set to the pull request number if the current job is a pull request build, or false if it’s not.\n function isSet(value: string | undefined) {\n // value can be or null, or empty string\n return value && value !== \"false\"\n }\n\n return isSet(process.env.TRAVIS_PULL_REQUEST) || isSet(process.env.CI_PULL_REQUEST) || isSet(process.env.CI_PULL_REQUESTS) || isSet(process.env.BITRISE_PULL_REQUEST) || isSet(process.env.APPVEYOR_PULL_REQUEST_NUMBER)\n}\n\nexport function isEnvTrue(value: string | null | undefined) {\n if (value != null) {\n value = value.trim()\n }\n return value === \"true\" || value === \"\" || value === \"1\"\n}\n\nexport class InvalidConfigurationError extends Error {\n constructor(message: string, code: string = \"ERR_ELECTRON_BUILDER_INVALID_CONFIGURATION\") {\n super(message);\n\n (this as NodeJS.ErrnoException).code = code\n }\n}\n\nexport function executeAppBuilder(args: Array<string>, childProcessConsumer?: (childProcess: ChildProcess) => void, extraOptions: SpawnOptions = {}): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const command = appBuilderPath\n const env: any = {\n ...process.env,\n SZA_PATH: path7za,\n FORCE_COLOR: chalk.enabled ? \"1\" : \"0\",\n }\n const cacheEnv = process.env.ELECTRON_BUILDER_CACHE\n if (cacheEnv != null && cacheEnv.length > 0) {\n env.ELECTRON_BUILDER_CACHE = path.resolve(cacheEnv)\n }\n\n if (extraOptions.env != null) {\n Object.assign(env, extraOptions.env)\n }\n\n const childProcess = doSpawn(command, args, {\n env,\n stdio: [\"ignore\", \"pipe\", process.stdout],\n ...extraOptions,\n })\n if (childProcessConsumer != null) {\n childProcessConsumer(childProcess)\n }\n handleProcess(\"close\", childProcess, command, resolve, error => {\n if (error instanceof ExecError && error.exitCode === 2) {\n error.alreadyLogged = true\n }\n reject(error)\n })\n })\n}\n"],"sourceRoot":""}
|