unix pipes + python
Timothy Docker
timd at macquarie.com.au
Thu Dec 28 18:56:47 EST 2000
More information about the Python-list mailing list
Thu Dec 28 18:56:47 EST 2000
- Previous message (by thread): automating excel with python ... getting excel to go away
- Next message (by thread): unix pipes + python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I must be doing something silly here... | import os | | def child( infd ) : | "Run a child process" | pid = os.fork() | if pid == 0: | if infd != None: os.dup2( infd, 0 ) | os.execv( '/usr/bin/cat', ['cat'] ) | else: | return pid | | toPipe,fromPipe = os.pipe() | child( fromPipe ) | os.write( toPipe, "hello\nthere\n" ) | os.close( toPipe ) This script behavious almost as expected. I end up with the text echoed back, but the 'cat' subprocess is left running - I was expecting it to exit when the write side of the pipe was closed in the parent, but it is still reading from fd 0. Any suggestions on what's wrong? Thanks, Tim
- Previous message (by thread): automating excel with python ... getting excel to go away
- Next message (by thread): unix pipes + python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list