@@ -334,23 +334,25 @@ class MinecraftStarter {
334
334
335
335
// Spawn options to prevent cmd window on Windows
336
336
const spawnOptions = {
337
- cwd : parentDir ,
338
- detached : true
337
+ cwd : parentDir
339
338
} ;
340
339
341
340
// Configure stdio based on platform to hide command prompt
342
341
if ( process . platform === 'win32' ) {
343
- // On Windows, use 'ignore' to completely hide the console window
344
- spawnOptions . stdio = 'ignore' ;
345
- // Also set windowsHide to true for extra protection
346
- spawnOptions . windowsHide = true ;
342
+ // On Windows, try conservative approach - just change detachment and shell
343
+ spawnOptions . stdio = [ 'ignore' , 'pipe' , 'pipe' ] ;
344
+ spawnOptions . shell = false ;
345
+ spawnOptions . detached = false ;
347
346
} else {
348
- // On macOS and Linux, use 'pipe' to capture output without showing terminal
347
+ // On macOS and Linux, use detached and pipe
348
+ spawnOptions . detached = true ;
349
349
spawnOptions . stdio = [ 'ignore' , 'pipe' , 'pipe' ] ;
350
350
}
351
351
352
352
console . log ( 'Launching Minecraft with args:' , args ) ;
353
353
console . log ( 'Spawn options:' , spawnOptions ) ;
354
+ console . log ( 'Platform:' , process . platform ) ;
355
+ console . log ( 'Access token provided:' , ! ! accessToken ) ;
354
356
355
357
// Spawn the process
356
358
const process = spawn ( args [ 0 ] , args . slice ( 1 ) , spawnOptions ) ;
@@ -359,7 +361,11 @@ class MinecraftStarter {
359
361
console . error ( `Error running executable: ${ error . message } ` ) ;
360
362
} ) ;
361
363
362
- // On non-Windows platforms, handle stdout/stderr if they exist
364
+ process . on ( 'spawn' , ( ) => {
365
+ console . log ( 'Process spawned successfully' ) ;
366
+ } ) ;
367
+
368
+ // On all platforms, handle stdout/stderr if they exist
363
369
if ( process . stdout ) {
364
370
process . stdout . on ( 'data' , ( data ) => {
365
371
console . log ( `Minecraft stdout: ${ data } ` ) ;
@@ -372,6 +378,14 @@ class MinecraftStarter {
372
378
} ) ;
373
379
}
374
380
381
+ process . on ( 'close' , ( code , signal ) => {
382
+ console . log ( `Process closed with code ${ code } and signal ${ signal } ` ) ;
383
+ } ) ;
384
+
385
+ process . on ( 'exit' , ( code , signal ) => {
386
+ console . log ( `Process exited with code ${ code } and signal ${ signal } ` ) ;
387
+ } ) ;
388
+
375
389
process . unref ( ) ;
376
390
return process ;
377
391
} catch ( error ) {
0 commit comments