Skip to content

Commit f07a746

Browse files
committed
Update 1 code files
Modified: • src/omnipkg/common_utils.py (+9/-8 lines) [gitship-generated]
1 parent c7384fd commit f07a746

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/omnipkg/common_utils.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -738,15 +738,16 @@ def is_interactive_session():
738738
def _worker_emit(obj: dict) -> None:
739739
"""Write one JSON line to the real stdout pipe, bypassing StreamRedirector."""
740740
msg = json.dumps(obj, ensure_ascii=True) + "\n"
741-
os.write(1, msg.encode("utf-8"))
741+
try:
742+
# Windows: stdout may be text-buffered, use buffer + explicit flush
743+
sys.stdout.buffer.write(msg.encode("utf-8"))
744+
sys.stdout.buffer.flush()
745+
except AttributeError:
746+
# Fallback for environments without buffer attribute
747+
os.write(1, msg.encode("utf-8"))
742748

743749

744750
def _worker_read_reply() -> dict:
745-
"""Read one JSON line from worker stdin (the daemon reply channel).
746-
747-
The daemon writes to worker.process.stdin (also text mode) after
748-
receiving the stdin_line from the C dispatcher.
749-
"""
750751
import threading
751752
result = [None]
752753
exc = [None]
@@ -759,9 +760,9 @@ def _read():
759760

760761
t = threading.Thread(target=_read, daemon=True)
761762
t.start()
762-
t.join(5.0)
763+
t.join(10.0) # bump to 10s for slow Windows pipes
763764
if t.is_alive():
764-
raise TimeoutError("no stdin reply within 5s")
765+
raise TimeoutError("no stdin reply within 10s")
765766
if exc[0]:
766767
raise exc[0]
767768
if not result[0]:

0 commit comments

Comments
 (0)