9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] APE select() and awkward Python subprocess PIPEfitting
@ 2013-02-26  2:29 Jeff Sickel
  2013-02-26  5:53 ` Jeff Sickel
  2013-02-26 11:25 ` Yaroslav
  0 siblings, 2 replies; 14+ messages in thread
From: Jeff Sickel @ 2013-02-26  2:29 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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):

; diff /sys/src/ape/lib/ap/plan9/_buf.c _buf.c
292a293
> printf("no buffered %d\n", i);
294a296
> /*
298c300
< 				errno = EBADF;		/* how X tells a client is gone */
---
> 				errno = EBADF;		// how X tells a client is gone
300a303
> */



By removing the above, Python code that uses subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE) 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.

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?

If not, I'll prep a patch.  Thanks.

-jas




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-27 15:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-26  2:29 [9fans] APE select() and awkward Python subprocess PIPEfitting Jeff Sickel
2013-02-26  5:53 ` Jeff Sickel
2013-02-26 11:25 ` Yaroslav
2013-02-26 11:41   ` Charles Forsyth
2013-02-26 16:17     ` Jeff Sickel
2013-02-26 15:29   ` Jeff Sickel
2013-02-26 16:20     ` Charles Forsyth
2013-02-26 16:26       ` Charles Forsyth
2013-02-26 17:01         ` Jeff Sickel
2013-02-26 18:36           ` Charles Forsyth
2013-02-26 16:48     ` Anthony Sorace
2013-02-26 18:25       ` Jeff Sickel
2013-02-27  2:03     ` Federico G. Benavento
2013-02-27 15:03       ` Jeff Sickel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).