From 1732932c5750cb5c90e241ce41485463244e0d54 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 15 Jan 2026 03:58:26 +0000 Subject: [PATCH] fix: unblock launchctl stub on windows --- src/browser/routes/agent.snapshot.ts | 3 +-- src/cli/browser-cli-inspect.ts | 3 +-- src/daemon/launchd.test.ts | 8 ++------ src/daemon/launchd.ts | 1 + 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/browser/routes/agent.snapshot.ts b/src/browser/routes/agent.snapshot.ts index 1a759bc2e..89cd590d0 100644 --- a/src/browser/routes/agent.snapshot.ts +++ b/src/browser/routes/agent.snapshot.ts @@ -146,8 +146,7 @@ export function registerBrowserAgentSnapshotRoutes(app: express.Express, ctx: Br const labels = toBoolean(req.query.labels) ?? undefined; const explicitFormat = req.query.format === "aria" ? "aria" : req.query.format === "ai" ? "ai" : undefined; - const format = - explicitFormat ?? (mode ? "ai" : (await getPwAiModule()) ? "ai" : "aria"); + const format = explicitFormat ?? (mode ? "ai" : (await getPwAiModule()) ? "ai" : "aria"); const limitRaw = typeof req.query.limit === "string" ? Number(req.query.limit) : undefined; const hasMaxChars = Object.hasOwn(req.query, "maxChars"); const maxCharsRaw = diff --git a/src/cli/browser-cli-inspect.ts b/src/cli/browser-cli-inspect.ts index 21353755e..0e58f4b55 100644 --- a/src/cli/browser-cli-inspect.ts +++ b/src/cli/browser-cli-inspect.ts @@ -62,8 +62,7 @@ export function registerBrowserInspectCommands( const baseUrl = resolveBrowserControlUrl(parent?.url); const profile = parent?.browserProfile; const format = opts.format === "aria" ? "aria" : "ai"; - const mode = - opts.efficient === true || opts.mode === "efficient" ? "efficient" : undefined; + const mode = opts.efficient === true || opts.mode === "efficient" ? "efficient" : undefined; try { const result = await browserSnapshot(baseUrl, { format, diff --git a/src/daemon/launchd.test.ts b/src/daemon/launchd.test.ts index e0d23fd23..fec37a6fa 100644 --- a/src/daemon/launchd.test.ts +++ b/src/daemon/launchd.test.ts @@ -44,7 +44,7 @@ describe("launchd install", () => { 'import fs from "node:fs";', "const logPath = process.env.CLAWDBOT_TEST_LAUNCHCTL_LOG;", "if (logPath) {", - " fs.appendFileSync(logPath, JSON.stringify(process.argv.slice(2)) + \"\\n\", \"utf8\");", + ' fs.appendFileSync(logPath, JSON.stringify(process.argv.slice(2)) + "\\n", "utf8");', "}", "process.exit(0);", "", @@ -60,11 +60,7 @@ describe("launchd install", () => { ); } else { const shPath = path.join(binDir, "launchctl"); - await fs.writeFile( - shPath, - `#!/bin/sh\nnode "$(dirname "$0")/launchctl.js" "$@"\n`, - "utf8", - ); + await fs.writeFile(shPath, `#!/bin/sh\nnode "$(dirname "$0")/launchctl.js" "$@"\n`, "utf8"); await fs.chmod(shPath, 0o755); } diff --git a/src/daemon/launchd.ts b/src/daemon/launchd.ts index 0d72e9d23..89a65eed8 100644 --- a/src/daemon/launchd.ts +++ b/src/daemon/launchd.ts @@ -127,6 +127,7 @@ async function execLaunchctl( try { const { stdout, stderr } = await execFileAsync("launchctl", args, { encoding: "utf8", + shell: process.platform === "win32", }); return { stdout: String(stdout ?? ""),