Skip to content

Commit 56779cc

Browse files
author
Simeon Kummer
committed
try again
1 parent 7fd5f20 commit 56779cc

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

src/minecraftStarter.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,23 +334,25 @@ class MinecraftStarter {
334334

335335
// Spawn options to prevent cmd window on Windows
336336
const spawnOptions = {
337-
cwd: parentDir,
338-
detached: true
337+
cwd: parentDir
339338
};
340339

341340
// Configure stdio based on platform to hide command prompt
342341
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;
347346
} 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;
349349
spawnOptions.stdio = ['ignore', 'pipe', 'pipe'];
350350
}
351351

352352
console.log('Launching Minecraft with args:', args);
353353
console.log('Spawn options:', spawnOptions);
354+
console.log('Platform:', process.platform);
355+
console.log('Access token provided:', !!accessToken);
354356

355357
// Spawn the process
356358
const process = spawn(args[0], args.slice(1), spawnOptions);
@@ -359,7 +361,11 @@ class MinecraftStarter {
359361
console.error(`Error running executable: ${error.message}`);
360362
});
361363

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
363369
if (process.stdout) {
364370
process.stdout.on('data', (data) => {
365371
console.log(`Minecraft stdout: ${data}`);
@@ -372,6 +378,14 @@ class MinecraftStarter {
372378
});
373379
}
374380

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+
375389
process.unref();
376390
return process;
377391
} catch (error) {

0 commit comments

Comments
 (0)