fix: unblock launchctl stub on windows
This commit is contained in:
@@ -146,8 +146,7 @@ export function registerBrowserAgentSnapshotRoutes(app: express.Express, ctx: Br
|
|||||||
const labels = toBoolean(req.query.labels) ?? undefined;
|
const labels = toBoolean(req.query.labels) ?? undefined;
|
||||||
const explicitFormat =
|
const explicitFormat =
|
||||||
req.query.format === "aria" ? "aria" : req.query.format === "ai" ? "ai" : undefined;
|
req.query.format === "aria" ? "aria" : req.query.format === "ai" ? "ai" : undefined;
|
||||||
const format =
|
const format = explicitFormat ?? (mode ? "ai" : (await getPwAiModule()) ? "ai" : "aria");
|
||||||
explicitFormat ?? (mode ? "ai" : (await getPwAiModule()) ? "ai" : "aria");
|
|
||||||
const limitRaw = typeof req.query.limit === "string" ? Number(req.query.limit) : undefined;
|
const limitRaw = typeof req.query.limit === "string" ? Number(req.query.limit) : undefined;
|
||||||
const hasMaxChars = Object.hasOwn(req.query, "maxChars");
|
const hasMaxChars = Object.hasOwn(req.query, "maxChars");
|
||||||
const maxCharsRaw =
|
const maxCharsRaw =
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ export function registerBrowserInspectCommands(
|
|||||||
const baseUrl = resolveBrowserControlUrl(parent?.url);
|
const baseUrl = resolveBrowserControlUrl(parent?.url);
|
||||||
const profile = parent?.browserProfile;
|
const profile = parent?.browserProfile;
|
||||||
const format = opts.format === "aria" ? "aria" : "ai";
|
const format = opts.format === "aria" ? "aria" : "ai";
|
||||||
const mode =
|
const mode = opts.efficient === true || opts.mode === "efficient" ? "efficient" : undefined;
|
||||||
opts.efficient === true || opts.mode === "efficient" ? "efficient" : undefined;
|
|
||||||
try {
|
try {
|
||||||
const result = await browserSnapshot(baseUrl, {
|
const result = await browserSnapshot(baseUrl, {
|
||||||
format,
|
format,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ describe("launchd install", () => {
|
|||||||
'import fs from "node:fs";',
|
'import fs from "node:fs";',
|
||||||
"const logPath = process.env.CLAWDBOT_TEST_LAUNCHCTL_LOG;",
|
"const logPath = process.env.CLAWDBOT_TEST_LAUNCHCTL_LOG;",
|
||||||
"if (logPath) {",
|
"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);",
|
"process.exit(0);",
|
||||||
"",
|
"",
|
||||||
@@ -60,11 +60,7 @@ describe("launchd install", () => {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const shPath = path.join(binDir, "launchctl");
|
const shPath = path.join(binDir, "launchctl");
|
||||||
await fs.writeFile(
|
await fs.writeFile(shPath, `#!/bin/sh\nnode "$(dirname "$0")/launchctl.js" "$@"\n`, "utf8");
|
||||||
shPath,
|
|
||||||
`#!/bin/sh\nnode "$(dirname "$0")/launchctl.js" "$@"\n`,
|
|
||||||
"utf8",
|
|
||||||
);
|
|
||||||
await fs.chmod(shPath, 0o755);
|
await fs.chmod(shPath, 0o755);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ async function execLaunchctl(
|
|||||||
try {
|
try {
|
||||||
const { stdout, stderr } = await execFileAsync("launchctl", args, {
|
const { stdout, stderr } = await execFileAsync("launchctl", args, {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
|
shell: process.platform === "win32",
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
stdout: String(stdout ?? ""),
|
stdout: String(stdout ?? ""),
|
||||||
|
|||||||
Reference in New Issue
Block a user