Skip to content

Commit 71a7b73

Browse files
committed
fix: resolve Windows spawn ENOENT error in SDK
Add shell: true option to spawn calls in createOpencodeServer and createOpencodeTui. This allows Node.js to properly resolve opencode executable on Windows while maintaining compatibility with Unix-like systems. Fixes anomalyco#2812
1 parent 3d332a0 commit 71a7b73

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎packages/sdk/js/src/server.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export async function createOpencodeServer(options?: ServerOptions) {
3030

3131
const proc = spawn(`opencode`, [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`], {
3232
signal: options.signal,
33+
shell: true,
3334
env: {
3435
...process.env,
3536
OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {}),
@@ -105,6 +106,7 @@ export function createOpencodeTui(options?: TuiOptions) {
105106

106107
const proc = spawn(`opencode`, args, {
107108
signal: options?.signal,
109+
shell: true,
108110
stdio: "inherit",
109111
env: {
110112
...process.env,

0 commit comments

Comments
 (0)