Skip to content

Commit 84beca5

Browse files
committed
Hotfix: Industrial-strength stability fixes for Windows Installer (v1.1.9)
1 parent e939304 commit 84beca5

3 files changed

Lines changed: 29 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,20 @@ jobs:
5555
- name: Build Backend with PyInstaller
5656
run: |
5757
cd backend
58-
pyinstaller --onefile --noconsole --collect-all uvicorn --collect-all fastapi api_server.py
58+
pyinstaller --onefile --noconsole \
59+
--collect-all uvicorn \
60+
--collect-all fastapi \
61+
--hidden-import=uvicorn.logging \
62+
--hidden-import=uvicorn.loops \
63+
--hidden-import=uvicorn.loops.auto \
64+
--hidden-import=uvicorn.protocols \
65+
--hidden-import=uvicorn.protocols.http \
66+
--hidden-import=uvicorn.protocols.http.auto \
67+
--hidden-import=uvicorn.protocols.websockets \
68+
--hidden-import=uvicorn.protocols.websockets.auto \
69+
--hidden-import=uvicorn.lifespan \
70+
--hidden-import=uvicorn.lifespan.on \
71+
api_server.py
5972
# Move binary to backend root so it's picked up by extraResources
6073
if [ "${{ matrix.os }}" = "windows-latest" ]; then
6174
mv dist/api_server.exe .

backend/api_server.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
import os
2+
import sys
3+
import multiprocessing
4+
5+
# --- CRITICAL: REDIRECT STREAMS IN FROZEN EXE ---
6+
# If running as a PyInstaller --noconsole EXE, stdout/stderr are None, which crashes many libraries.
7+
if getattr(sys, 'frozen', False) and sys.platform == "win32":
8+
null_device = open(os.devnull, 'w')
9+
sys.stdout = null_device
10+
sys.stderr = null_device
11+
# Also ensure freeze_support is called as early as possible
12+
multiprocessing.freeze_support()
13+
114
import asyncio
215
import collections
3-
import multiprocessing
416
import threading
517
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, HTTPException, Request, Query
6-
from fastapi.middleware.cors import CORSMiddleware
7-
from pydantic import BaseModel
8-
from typing import Optional, List, Dict
9-
from fastapi import UploadFile, File
10-
import os
11-
import sys
1218
import json
1319
import logging
1420
from queue import Queue

changelog.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
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** — Added `freeze_support()` and improved PyInstaller bundling to prevent the backend from crashing when running from the GitHub-generated `.exe`.
20-
- **Robust Forge version handling** — Versions like "26.1.1" now correctly trigger the Java 25 requirement.
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.
20+
- **Robust Forge version handling** — Versions like "26.1.1" now correctly trigger the Java 25 requirement and use the managed environment.
2121

2222
### 🔧 IMPROVEMENTS:
2323
- **Smart close behavior** — App checks for running servers before deciding to hide or quit

0 commit comments

Comments
 (0)