From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) From: Jeff Sickel In-Reply-To: <0BE4B21D-EDA9-4DF5-8515-7BA27841B3E3@corpus-callosum.com> Date: Mon, 25 Feb 2013 23:53:09 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <62A315BD-CDC8-424D-9F5E-EE615F285E39@corpus-callosum.com> References: <0BE4B21D-EDA9-4DF5-8515-7BA27841B3E3@corpus-callosum.com> To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Subject: Re: [9fans] APE select() and awkward Python subprocess PIPEfitting Topicbox-Message-UUID: 1f1f01d0-ead8-11e9-9d60-3106f5b1d025 Actually, that printf was for my debugging: diff /sys/src/ape/lib/ap/plan9/_buf.c _buf.c 294a295 > /* 298c299 < errno =3D EBADF; /* how X = tells a client is gone */ --- > errno =3D EBADF; // how X = tells a client is gone 300a302 > */ On Feb 25, 2013, at 8:29 PM, Jeff Sickel = wrote: > I've been tracking down little errors in the APE select() function = that cropped up when trying to use Python's subprocess module. After a = few too many hours of investigation, I've come to the conclusion that = the code that causes error is intentional code to handle a specific case = for X (I'll assume X11 until corrected): >=20 > ; diff /sys/src/ape/lib/ap/plan9/_buf.c _buf.c > 292a293 >> printf("no buffered %d\n", i); > 294a296 >> /* > 298c300 > < errno =3D EBADF; /* how X = tells a client is gone */ > --- >> errno =3D EBADF; // how X = tells a client is gone > 300a303 >> */ >=20 >=20 >=20 > By removing the above, Python code that uses subprocess.Popen(cmd, = stdout=3DPIPE, stderr=3DPIPE) will now work correctly, without having to = resort to os.popen3(cmd) attempts to get around the select.error: (4, = 'Bad file number') that would crop up without the change. >=20 > My question is: does anyone still use the X11 code based on APE? Is = this section safe to remove in sources? Or do you have additional = recommendations to work around the select() error? >=20 > If not, I'll prep a patch. Thanks. >=20 > -jas >=20 >=20