Skip to content

Commit 28a24c7

Browse files
committed
Support windows paths and process running
1 parent 2b0d1e9 commit 28a24c7

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/CodexJsonRpcConnection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import path from "node:path";
88
import {createJSONRPCReader, createJSONRPCWriter} from "./StdUtils";
99

1010
export function startCodexConnection(codexPath: string, logPath?: string): MessageConnection {
11-
const codex: ChildProcessWithoutNullStreams = spawn(codexPath, ["app-server"]);
11+
const codex: ChildProcessWithoutNullStreams = spawn(`"${codexPath}" app-server`, {
12+
shell: process.platform === 'win32'
13+
});
1214

1315
if (logPath) {
1416
attachLogs(codex, logPath);

src/__tests__/acp-test-utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {type CodexConnectionEvent, CodexAppServerClient} from '../CodexAppServer
33
import {startCodexConnection} from "../CodexJsonRpcConnection";
44
import {CodexAcpServer} from "../CodexAcpServer";
55
import type {AgentSideConnection} from "@agentclientprotocol/sdk";
6+
import path from "node:path";
67

78
export type MethodCallEvent = { method: string; args: any[] };
89

@@ -32,14 +33,15 @@ export interface TestFixture {
3233
}
3334

3435
export function createTestFixture(): TestFixture {
35-
const pathToCodex = "././node_modules/.bin/codex"
36+
const pathToCodex = path.resolve(process.cwd(), "node_modules", ".bin", process.platform === 'win32' ? "codex.cmd" : "codex");
3637
const acpConnectionEvents: MethodCallEvent[] = []
3738
const acpEventHandlers: ((event: MethodCallEvent) => void)[] = [];
3839
const acpConnection = createSmartMock<AgentSideConnection>((event) => {
3940
acpConnectionEvents.push(event);
4041
acpEventHandlers.forEach(handler => handler(event));
4142
});
42-
const codexAppServerClient = new CodexAppServerClient(startCodexConnection(pathToCodex));
43+
const codexConnection = startCodexConnection(pathToCodex);
44+
const codexAppServerClient = new CodexAppServerClient(codexConnection);
4345

4446
const codexAcpClient = new CodexAcpClient(codexAppServerClient);
4547
const codexAcpAgent = new CodexAcpServer(acpConnection, codexAcpClient);

0 commit comments

Comments
 (0)