On Fri, Nov 12 2021, Lars Ingebrigtsen wrote: >> However, I would like to propose >> that, in status_notify, the sentinel function should be called before >> closing the file descriptors. That way, the sentinel can read the >> buffered output as suggested in the example. > > A sentinel usually doesn't read anything... The idea is that the sentinel does something like this: (lambda (p _) (set-process-filter p filter) (while (accept-process-output p 0))) First, it changes the filter from t to an actual function. Then it calls accept-process-output. This in turn polls the file descriptors and calls the filter function if there is buffered output. If there is no buffered output to read, then accept-process-output returns nil and the while loop terminates. All this happens after the process has terminated. Granted, not a particularly intuitive API. However, the required change would be rather small, I think. The patch below shows how this could be done. It basically moves the part that closes the file descriptors after the call to exec_sentinel.