@@ -96,15 +96,15 @@ describe('remote access server', () => {
9696 }
9797 } )
9898 } )
99- // /bin/sh does not exist on Windows. Node is the one interpreter guaranteed
100- // to be present wherever this suite runs. Keep it alive until input arrives
101- // so native PTY startup and immediate process exit cannot race on macOS.
102- const script = 'process.stdin.once("data", () => process.stdout.write("remote-pty-ok"))'
103- const create = await rpc ( 'pty' , 'pty.create' , { paneId : 'web-test' , cwd : root , shell : process . execPath , argv : [ '-e' , script ] } )
99+ // Exercise the same default OS shell CrewCode opens for a real terminal.
100+ // Treating Node as a shell is not portable: macOS node-pty can reject it via
101+ // posix_spawnp, while ConPTY may launch it without honoring the -e fixture.
102+ const create = await rpc ( 'pty' , 'pty.create' , { paneId : 'web-test' , cwd : root } )
104103 expect ( create . status ) . toBe ( 200 )
105104 const createBody = await create . json ( ) as { ok : boolean ; result ?: { ok ?: boolean ; error ?: string } }
106105 expect ( createBody ) . toMatchObject ( { ok : true , result : { ok : true } } )
107- const write = await rpc ( 'pty-write' , 'pty.write' , { paneId : 'web-test' , data : 'go\n' } )
106+ const enter = process . platform === 'win32' ? '\r' : '\n'
107+ const write = await rpc ( 'pty-write' , 'pty.write' , { paneId : 'web-test' , data : `echo remote-pty-ok${ enter } ` } )
108108 expect ( write . status ) . toBe ( 200 )
109109 await expect ( output ) . resolves . toContain ( 'remote-pty-ok' )
110110 socket . close ( )
0 commit comments