Ask HN: Query whether a pipe is empty AND has a reader waiting?

3 points by jsyjr ↗ HN
I have long dreamed of recreating, within Emacs, the input and transcript functionality of the Apollo DM (Display Manager):

  https://lists.suckless.org/dev/1106/8766.html
The distinguishing characteristic of a DM transcript was that it recorded faithfully and immutably the interleaving of input consumed from stdin with output written to stdout. Of course, in the absence of typeahead, creating such a transcript is trivial.

The essential implementation hurdle then is handling typeahead. And that comes down to being able to ask whether the pipe supplying stdin is both (1) empty and (2) has a read waiting.

So my question is, can one do that on a contemporary instance any of the big three OSs? Linux, BSD or Windows?

0 comments

[ 4.6 ms ] story [ 7.2 ms ] thread

No comments yet.