import { exec, executeAppBuilder } from "builder-util" import { ExecFileOptions } from "child_process" /** @private */ export function execWine(file: string, file64: string | null = null, appArgs: Array = [], options: ExecFileOptions = {}): Promise { if (process.platform === "win32") { if (options.timeout == null) { // 2 minutes options.timeout = 120 * 1000 } return exec(file, appArgs, options) } const commandArgs = ["wine", "--ia32", file] if (file64 != null) { commandArgs.push("--x64", file64) } if (appArgs.length > 0) { commandArgs.push("--args", JSON.stringify(appArgs)) } return executeAppBuilder(commandArgs, undefined, options) } /** @private */ export function prepareWindowsExecutableArgs(args: Array, exePath: string) { if (process.platform !== "win32") { args.unshift(exePath) } return args }