|
1 | 1 | import { AllPublishOptions } from "builder-util-runtime" |
2 | | -import { spawn, spawnSync } from "child_process" |
| 2 | +import { spawn, SpawnOptions, spawnSync, StdioOptions } from "child_process" |
3 | 3 | import { AppAdapter } from "./AppAdapter" |
4 | 4 | import { AppUpdater, DownloadExecutorTask } from "./AppUpdater" |
5 | 5 |
|
@@ -134,20 +134,19 @@ export abstract class BaseUpdater extends AppUpdater { |
134 | 134 | */ |
135 | 135 | // https://github.com/electron-userland/electron-builder/issues/1129 |
136 | 136 | // Node 8 sends errors: https://nodejs.org/dist/latest-v8.x/docs/api/errors.html#errors_common_system_errors |
137 | | - protected async spawnLog(cmd: string, args: string[] = [], env: any = {}): Promise<boolean> { |
| 137 | + protected async spawnLog(cmd: string, args: string[] = [], env: any = undefined, stdio: StdioOptions = "ignore"): Promise<boolean> { |
138 | 138 | this._logger.info(`Executing: ${cmd} with args: ${args}`) |
139 | 139 | return new Promise<boolean>((resolve, reject) => { |
140 | 140 | try { |
141 | | - const p = spawn(cmd, args, { |
142 | | - stdio: "inherit", |
143 | | - env: { ...process.env, ...env }, |
144 | | - detached: true, |
145 | | - }) |
| 141 | + const params: SpawnOptions = { stdio, env, detached: true } |
| 142 | + const p = spawn(cmd, args, params) |
146 | 143 | p.on("error", error => { |
147 | 144 | reject(error) |
148 | 145 | }) |
149 | 146 | p.unref() |
150 | | - resolve(p.pid !== undefined) |
| 147 | + if (process.pid !== undefined) { |
| 148 | + resolve(true) |
| 149 | + } |
151 | 150 | } catch (error) { |
152 | 151 | reject(error) |
153 | 152 | } |
|
0 commit comments