How to disable output messages of the child process, in spawnv( )?

Grant Edwards grante at visi.com
Wed Jul 23 21:11:05 CEST 2003


In article <db3b6d24.0307231050.74d41e66 at posting.google.com>, nushin wrote:
> I'd like to disable the output of the process spawned by spawnv( )
> API, but the catch is that i *have to* see the output of the parent
> process making the  spawnv( ) call. Has anyone done that? I have some
> pointers that by using dup2( ) API i might be able to do that, any
> ideas how? Also, i have to spawn as an asynch call, using P_NOWAIT,
> e.g.,:
> 
> os.spawnv(os.P_NOWAIT,'/usr/bin/python',('python','hello.py'),('>/dev/null &'))

Nope.  

The ">" and "&" are things that a shell (like bash or ksh)
handles.  The python interpreter has no idea what to do with
them.  If you want to use ">" and "&", then spawn a shell, and
pass it a command to run the python program with output
redirected.

-- 
Grant Edwards                   grante             Yow!  I'm RELIGIOUS!! I
                                  at               love a man with a
                               visi.com            HAIRPIECE!! Equip me with
                                                   MISSILES!!




More information about the Python-list mailing list