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

Discussion in 'Python' started by Grant Edwards, Jul 23, 2003.

  1. In article <>, 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!!
    Grant Edwards, Jul 23, 2003
    #1
    1. Advertising

  2. Grant Edwards

    nushin Guest

    Is there any trick to disable the output of a child process spawned by
    spawnv( ) API?

    I believe in Python and i am sure there's a way around it. Correct me
    if i am wrong.

    Regards,
    Nushin (BB)

    (Grant Edwards) wrote in message news:<3f1eddc9$0$160$>...
    > In article <>, 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.
    nushin, Jul 24, 2003
    #2
    1. Advertising

  3. Grant Edwards

    Donn Cave Guest

    Quoth (nushin):
    | Is there any trick to disable the output of a child process spawned by
    | spawnv( ) API?

    No.

    | I believe in Python and i am sure there's a way around it. Correct me
    | if i am wrong.

    You believe in tricks, is the problem. Read what people are telling you.
    You can redirect output of a command, you can do it Python, but the only
    way to do it in spawnv is to make spawnv execute a shell command.

    Donn Cave,

    | (Grant Edwards) wrote in message news:<3f1eddc9$0$160$>...
    |> In article <>, 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.
    Donn Cave, Jul 24, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nushin
    Replies:
    1
    Views:
    470
    Donn Cave
    Jul 23, 2003
  2. nushin
    Replies:
    0
    Views:
    343
    nushin
    Jul 29, 2003
  3. nushin
    Replies:
    3
    Views:
    6,849
    nushin
    Aug 7, 2003
  4. Gauri
    Replies:
    3
    Views:
    177
  5. Gauri
    Replies:
    4
    Views:
    187
    -berlin.de
    Feb 28, 2007
Loading...

Share This Page