Skip to content

Commit d7dc6ec

Browse files
committed
test(cursor): make executor fixtures cross-platform
1 parent c048705 commit d7dc6ec

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/adapters/cursor/native-exec-desktop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const DEFAULT_DESKTOP_TIMEOUT_MS = 30_000;
2626
* command receives the request as JSON on stdin and must print a JSON result on stdout.
2727
*/
2828
export interface DesktopExecutorConfig {
29-
/** Command (run via `sh -c`) handling computer-use. Receives `{toolCallId, actions}` on stdin. */
29+
/** Command (run via the platform shell) handling computer-use. Receives `{toolCallId, actions}` on stdin. */
3030
computerUseCommand?: string;
3131
/** Command handling record-screen. Receives `{mode, toolCallId, saveAsFilename?}` on stdin. */
3232
recordScreenCommand?: string;

tests/cursor-desktop-exec.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ function decode(bytes: Uint8Array) {
2020
return msg.message.value;
2121
}
2222

23-
// A tiny shell command that prints a fixed JSON payload, ignoring stdin.
24-
function echoJson(json: string): string {
23+
// A tiny platform-shell command that drains stdin and prints a fixed JSON payload.
24+
function echoJson(json: string, platform: NodeJS.Platform = process.platform): string {
25+
if (platform === "win32") return `more >nul & echo ${json}`;
2526
return `cat >/dev/null; printf '%s' '${json}'`;
2627
}
2728

@@ -124,6 +125,10 @@ describe("Cursor desktop executor hooks", () => {
124125
});
125126

126127
describe("desktop executor platform shell (devlog 260715_cross_platform_audit/020)", () => {
128+
test("behavior fixture uses CMD built-ins on win32", () => {
129+
expect(echoJson('{"durationMs":42}', "win32")).toBe('more >nul & echo {"durationMs":42}');
130+
});
131+
127132
test("POSIX invocation stays byte-identical to sh -c for both configured commands", () => {
128133
const computerUse = "cat >/dev/null; printf '%s' '{\"durationMs\":42}'";
129134
const recordScreen = "cat >/dev/null; printf '%s' '{\"startSuccess\":{}}'";

0 commit comments

Comments
 (0)