File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -325,6 +325,7 @@ export class EngineClient {
325325 method : "POST" ,
326326 headers : { "Content-Type" : "application/json" } ,
327327 body : JSON . stringify ( body ) ,
328+ signal : AbortSignal . timeout ( 600_000 ) ,
328329 } ) ;
329330 if ( ! resp . ok ) {
330331 const text = await resp . text ( ) ;
Original file line number Diff line number Diff line change @@ -792,19 +792,25 @@ async def run_miniprogram_blueprint_test(req: dict) -> TestReportResponse:
792792 )
793793 )
794794
795- # 实时读stderr推送步骤进度(线程读取 + 协程推送 )
795+ # 同时读stdout和stderr(避免管道缓冲区满导致死锁 )
796796 import threading
797797 _stderr_buf = []
798+ _stdout_chunks = []
798799 _stderr_done = threading .Event ()
800+ _stdout_done = threading .Event ()
799801 loop = asyncio .get_event_loop ()
800802
801803 def _stream_stderr ():
802804 for line in proc .stderr :
803805 _stderr_buf .append (line .rstrip ())
804806 _stderr_done .set ()
805807
806- stderr_thread = threading .Thread (target = _stream_stderr , daemon = True )
807- stderr_thread .start ()
808+ def _stream_stdout ():
809+ _stdout_chunks .append (proc .stdout .read ())
810+ _stdout_done .set ()
811+
812+ threading .Thread (target = _stream_stderr , daemon = True ).start ()
813+ threading .Thread (target = _stream_stdout , daemon = True ).start ()
808814
809815 _last_pushed = 0
810816 while not _stderr_done .is_set () or _last_pushed < len (_stderr_buf ):
@@ -819,9 +825,10 @@ def _stream_stderr():
819825 parts = line [len ("[STEP]" ):].strip ()
820826 await ws_manager .send_log (parts )
821827
822- # 等Node进程结束,读取stdout
823- stdout_data = await loop . run_in_executor ( None , proc . stdout . read )
828+ # 等stdout线程和进程结束
829+ _stdout_done . wait ( timeout = 30 )
824830 await loop .run_in_executor (None , proc .wait )
831+ stdout_data = "" .join (_stdout_chunks )
825832
826833 # 清理临时文件
827834 try :
You can’t perform that action at this time.
0 commit comments