Tags: patch Compile the following C program, close_and_sit.c: #include #include void main() { fclose(stdout); fclose(stderr); while (1) sleep(1); } Then run this snippet of Lisp, updating the executable file name appropriately: (make-process :name "close_and_sit" :command '("./close_and_sit") :connection-type 'pipe) (make-process :name "true" :command '("true")) (message "accept-process-output") (accept-process-output nil 1) This will cause Emacs to hang; accept-process-output will never time out. There are two bugs which combine to cause this. The first bug is in our timeout handling. The attached patch resolves that, which causes accept-process-output to time out properly and fixes the bug. Paul, this patch partially reverts a change you made to cache current_timespec. Does it seem right to you? The second bug is that when a child process closes stdout/stderr, we continue watching the pipe, generating spurious events. (We should still be timing out despite the spurious events - real events could also cause this hang, this bug just makes it easier to trigger the hang.) I'm still working on a patch to fix the second bug.