fix: route all config_builder prints through safe_print to avoid Windows OSError

This commit is contained in:
Jason Hoku
2026-04-22 17:33:35 -07:00
parent 276e03d6a3
commit cbc82026bc
+10 -1
View File
@@ -8,6 +8,7 @@ import os
import sys
import json
import time
import builtins
import folder_paths
from typing import List, Dict, Any
import server
@@ -24,7 +25,7 @@ def safe_print(*args, **kwargs):
OSError [Errno 22] from Windows console bugs crashing node execution.
"""
try:
print(*args, **kwargs)
builtins.print(*args, **kwargs)
except (OSError, ValueError):
try:
msg = " ".join(str(a) for a in args) + kwargs.get("end", "\n")
@@ -34,6 +35,14 @@ def safe_print(*args, **kwargs):
pass # Drop silently — don't crash the node over a log line
# Shadow the module-level `print` so every print() call in this file routes
# through safe_print. Without this, sibling methods (process_lora_array,
# lookup_triggers_endpoint, etc.) still hit the broken stdout and crash with
# OSError [Errno 22] on Windows — the local `print = safe_print` in
# generate_config only covers that one function.
print = safe_print
# =============================================================================