From 1cb19e93f9b2f918fc94831e6ea85b2074ccda6d Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 5 Jun 2023 21:59:16 -0400 Subject: [PATCH] no need to use a primitive splitting method when execa has it built in. Fixes a bug on windows when the path to QEMU has spaces --- src/QEMUVM.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/QEMUVM.ts b/src/QEMUVM.ts index 6bd9eb6..e66086a 100644 --- a/src/QEMUVM.ts +++ b/src/QEMUVM.ts @@ -2,7 +2,7 @@ import { EventEmitter } from "events"; import IConfig from "./IConfig.js"; import * as rfb from 'rfb2'; import * as fs from 'fs'; -import { execa, ExecaChildProcess } from "execa"; +import { execa, ExecaChildProcess, execaCommand } from "execa"; import QMPClient from "./QMPClient.js"; import BatchRects from "./RectBatcher.js"; import { createCanvas, Canvas, CanvasRenderingContext2D, createImageData } from "canvas"; @@ -71,8 +71,7 @@ export default class QEMUVM extends VM { log("ERROR", `Failed to delete existing socket: ${e}`); process.exit(-1); } - var qemuArr = this.qemuCmd.split(" "); - this.qemuProcess = execa(qemuArr[0], qemuArr.slice(1)); + this.qemuProcess = execaCommand(this.qemuCmd); this.qemuProcess.catch(() => false); this.qemuProcess.stderr?.on('data', (d) => log("ERROR", `QEMU sent to stderr: ${d.toString()}`)); this.qemuProcess.once('spawn', () => {