code: 9ferno

Download patch

ref: 2e67275d80c4cf5a3603c4db73b274a34ddfe642
parent: faa3a795058645892bb4b7ecc107914c80b87b2c
author: joe9 <>
date: Wed Jul 7 07:01:58 EDT 2021

fix for needing 2 Enter key presses after an os command

I am noticing this behaviour:

When the os command starts, it starts a reader process on stdin. This channel is added by wm/sh.b into a list of channels reading on the /dev/ (rdreq: list of channels). The /dev/ is the stdin of the os reader process.

When the os process dies, it kills the stdin reader process. But, the channel still remains in the wm/sh list of channels reading on the /dev/ file. I do not see any explicit cleanup by wm/sh of such channels (in the rdreq list of channels). The only cleanup that is happening is when we send something into that channel and the send fails.

This is the reason for the need to press Enter twice so that send to the first channel fails and the data is sent to the newer or later channel.

The wm/sh's sendinput function can use a loop to send to the next channel in the list of channels reading on the of /dev/ when the send to a channel fails.

But, I cannot figure out why others do not notice this behaviour. And, that makes me suspect that I might have messed up something in the dis.64 port.

--- a/appl/wm/sh.b
+++ b/appl/wm/sh.b
@@ -770,9 +770,13 @@
 		r.rc <-= (nil, nil) =>
 		* =>
+			if(len rdreq > 0)
+				sendinput(t);
 	* =>
+		if(len rdreq > 0)
+			sendinput(t);
 		return;	# requester has disappeared; ignore his request and try another