non-blocking sys.stdin.read() on win32?
Laurent Szyster
laurent.szyster at q-survey.be
Sun Jan 20 21:08:52 EST 2002
There's no way to do non-blocking I/O on STDIN on a Win32.
I don't know why and even never bothered to test it, but I
suppose we can trust Sam Rushing: he did try.
>From Medusa/monitor_client_win32.py:
# monitor client, win32 version
# since we can't do select() on stdin/stdout, we simply
# use threads and blocking sockets. <sigh>
Sorry to bring bad news,
Laurent
Michal Wallace wrote:
>
> Hi all.
>
> I'm making a replacement for rsh/ssh to be used by cvs's
> -d:ext: option.. CVS opens my program and sends data to it
> as if it were rsh. My program sends that data to a socket
> and then reads the response, which comes from a cvs server.
>
> Everything seems to work fine, but it's INCREDIBLY slow,
> because I only read one line at a time from stdin (the local
> cvs parent process):
>
> >>> local_msg = sys.stdin.readline()
>
> I want to just be able to call select() on sys.stdin and
> then, if appropriate, read more than one line of, but it
> doesn't let me, because on win32, python's select() only
> works for sockets.
>
> What can I do?
>
> (I'm not above using a C extension if that's what it takes,
> but I'm not much of a C programmer)
>
> Cheers,
>
> - Michal http://www.sabren.net/ sabren at manifestation.com
> ------------------------------------------------------------
> Give your ideas the perfect home: http://www.cornerhost.com/
> cvs - weblogs - php - linux shell - perl/python/cgi - java
> ------------------------------------------------------------
More information about the Python-list
mailing list