@@ -412,6 +412,25 @@ function main() {
412412 }
413413 }
414414
415+ // Patch node-pty windowsPtyAgent.js: the JS wrapper passes 7 args to
416+ // conptyNative.startProcess() but the native conpty.node only accepts 6.
417+ // Remove the 7th arg (useConptyDll) to fix PTY spawn on Windows.
418+ const ptyAgentPath = path . join ( nodeModulesPath , 'node-pty' , 'lib' , 'windowsPtyAgent.js' ) ;
419+ if ( fs . existsSync ( ptyAgentPath ) ) {
420+ let ptyAgent = fs . readFileSync ( ptyAgentPath , 'utf8' ) ;
421+ const broken = 'conptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor, this._useConptyDll)' ;
422+ const fixed = 'conptyNative.startProcess(file, cols, rows, debug, this._generatePipeName(), conptyInheritCursor)' ;
423+ if ( ptyAgent . includes ( broken ) ) {
424+ ptyAgent = ptyAgent . replace ( broken , fixed ) ;
425+ fs . writeFileSync ( ptyAgentPath , ptyAgent ) ;
426+ console . log ( '[tauri] Patched node-pty windowsPtyAgent.js (removed useConptyDll arg)' ) ;
427+ } else if ( ptyAgent . includes ( fixed ) ) {
428+ console . log ( '[tauri] node-pty windowsPtyAgent.js already patched' ) ;
429+ } else {
430+ console . warn ( '[tauri] WARNING: Could not find expected startProcess call in windowsPtyAgent.js — PTY may fail on Windows' ) ;
431+ }
432+ }
433+
415434 const marker = path . join ( outDir , 'server' , 'index.js' ) ;
416435 if ( ! fs . existsSync ( marker ) ) {
417436 throw new Error ( `Expected backend entry not found: ${ marker } ` ) ;
0 commit comments