diff --git a/c/glm.c b/c/glm.c index d6e5716..561d410 100644 --- a/c/glm.c +++ b/c/glm.c @@ -3418,6 +3418,14 @@ static void run_serve_mux(Model *m, const char *snap){ KVState *initial=m->kv; free(initial->kv_start); free(initial); ServeCtx *ctx=calloc(nctx,sizeof(*ctx)); ServeReq *req=calloc(nctx,sizeof(*req)); for(int i=0;i0) + /* Anonymous pipes are NOT waitable objects: WaitForSingleObject on them is + * undefined (always-signaled or WAIT_FAILED), and PeekNamedPipe fails on + * file/console handles — the old gate never dispatched (#195). New rule: + * idle -> block in getline() inside mux_submit (same semantics as the + * POSIX select(NULL)); active -> poll the pipe with PeekNamedPipe, and on + * non-pipe stdin just defer submits until the batch finishes. */ + if(eof) ready=0; + else if(!active) ready=1; + else ready=(PeekNamedPipe(ih,NULL,0,NULL,&avail,NULL) && avail>0)?1:0; + if(ready) #endif if(mux_submit(m,&T,ctx,req,nctx,maxctx,eos)<0) eof=1; }