@@ -2433,7 +2433,9 @@ def main(launch_args,start_server=True):
2433
2433
2434
2434
modelname = os .path .abspath (args .model_param )
2435
2435
print (args )
2436
- print (f"==========\n Loading model: { modelname } \n [Threads: { args .threads } , BlasThreads: { args .blasthreads } , SmartContext: { args .smartcontext } , ContextShift: { not (args .noshift )} ]" )
2436
+ # Flush stdout for win32 issue with regards to piping in terminals,
2437
+ # especially before handing over to C++ context.
2438
+ print (f"==========\n Loading model: { modelname } \n [Threads: { args .threads } , BlasThreads: { args .blasthreads } , SmartContext: { args .smartcontext } , ContextShift: { not (args .noshift )} ]" , flush = True )
2437
2439
loadok = load_model (modelname )
2438
2440
print ("Load Model OK: " + str (loadok ))
2439
2441
@@ -2507,10 +2509,12 @@ def onready_subprocess():
2507
2509
if start_server :
2508
2510
if args .remotetunnel :
2509
2511
setuptunnel ()
2510
- print (f"======\n Please connect to custom endpoint at { epurl } " )
2512
+ # Flush stdout for previous win32 issue so the client can see output.
2513
+ print (f"======\n Please connect to custom endpoint at { epurl } " , flush = True )
2511
2514
asyncio .run (RunServerMultiThreaded (args .host , args .port , embedded_kailite , embedded_kcpp_docs ))
2512
2515
else :
2513
- print (f"Server was not started, main function complete. Idling." )
2516
+ # Flush stdout for previous win32 issue so the client can see output.
2517
+ print (f"Server was not started, main function complete. Idling." , flush = True )
2514
2518
2515
2519
def run_in_queue (launch_args , input_queue , output_queue ):
2516
2520
main (launch_args , start_server = False )
0 commit comments