Skip to content

Commit f7d4bcb

Browse files
committed
Hotfix: Use raw binary log pumping to solve console hangs (v1.1.9)
1 parent 5e171e8 commit f7d4bcb

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

backend/server/server_handler.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,10 @@ def _run_server(self, command, env):
483483
cwd=self.server_path,
484484
stdout=subprocess.PIPE,
485485
stderr=subprocess.PIPE,
486-
stdin=subprocess.PIPE,
487-
text=True,
488-
encoding='utf-8',
489-
errors='replace',
490-
bufsize=1,
491-
universal_newlines=True,
486+
stdin=subprocess.DEVNULL,
487+
text=False,
488+
bufsize=0,
489+
universal_newlines=False,
492490
creationflags=subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0,
493491
env=env
494492
)
@@ -551,8 +549,15 @@ def _read_output(self, pipe, level):
551549
list_header_pattern = re.compile(r".*There are\s+\d+\s+of\s+a\s+max\s+of\s+\d+\s+players\s+online:\s*$", re.IGNORECASE)
552550

553551
try:
554-
logging.info(f"Handler: Log reader thread started for {level}")
555-
for line in iter(pipe.readline, ''):
552+
logging.info(f"Handler: Log reader thread started for {level} (Binary mode)")
553+
# In binary mode, readline returns bytes
554+
for line_bytes in iter(pipe.readline, b''):
555+
try:
556+
line = line_bytes.decode('utf-8', errors='replace')
557+
except Exception as de:
558+
logging.error(f"Handler: Decode error in {level}: {de}")
559+
continue
560+
556561
line_no_ansi = re.sub(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])', '', line)
557562

558563
# Check for standard server start completion messages

changelog.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
- **Fixed backend restart loop on Windows** — Watchdog now correctly monitors the Electron process using a passed PID, preventing premature restarts during installations.
1717
- **Improved Java version mapping** — Version detection now correctly maps high-version servers (NeoForge/NeoMinecraft 26.x+) to **Java 25**.
1818
- **Fixed Startup Scripts (run.bat/run.sh)** — Implemented **Environment Injection** (JAVA_HOME & PATH) to force startup scripts to use the app's managed Java version instead of the system default.
19-
- **Fixed Portable Executable Stability** — Implemented **Industrial Strength** fixes including `stdout/stderr` redirection and extensive dependency bundling (uvicorn/fastapi) to prevent crashes in the installer version.
19+
- **Fixed Portable Executable Stability** — Implemented **Industrial Strength** fixes including `stdout/stderr` redirection and binary, unbuffered log pumping to prevent console hangs in the installer version.
2020
- **Robust Forge version handling** — Versions like "26.1.1" now correctly trigger the Java 25 requirement and use the managed environment.
2121

2222
### 🔧 IMPROVEMENTS:

0 commit comments

Comments
 (0)