mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
Fix noconsole crash: redirect None stdout/stderr to devnull on Windows
This commit is contained in:
@@ -6,6 +6,14 @@ absolute imports instead of relative imports.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
# On Windows with --noconsole (PyInstaller), sys.stdout/stderr are None.
|
||||||
|
# Redirect to devnull to prevent crashes from print()/tqdm/logging.
|
||||||
|
if sys.stdout is None:
|
||||||
|
sys.stdout = open(os.devnull, 'w')
|
||||||
|
if sys.stderr is None:
|
||||||
|
sys.stderr = open(os.devnull, 'w')
|
||||||
|
|
||||||
# Fast path: handle --version before any heavy imports so the Rust
|
# Fast path: handle --version before any heavy imports so the Rust
|
||||||
# version check doesn't block for 30+ seconds loading torch etc.
|
# version check doesn't block for 30+ seconds loading torch etc.
|
||||||
|
|||||||
Reference in New Issue
Block a user