Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #108309

Re: redirecting stdout and stderr to /dev/null

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: redirecting stdout and stderr to /dev/null
Date 2016-05-08 10:10 +1000
Message-ID <mailman.484.1462666215.32212.python-list@python.org> (permalink)
References <CAJ2wgcp0HjygmdAw_Q1zJEs=BRWEuDnYRUzQPCcnZEbS0i3uSw@mail.gmail.com> <alpine.LSU.2.11.1605071151240.29512@znpeba.jbaqresebt.arg> <CAJ2wgcqYNZPap05ThA5YY048s_DYX45yPdt5RoVGXbtWAomWqQ@mail.gmail.com> <CAPTjJmodwRC8w29h35YM2=twNkifVT-=8+gSeY=oRdyLNfFC0A@mail.gmail.com>

Show all headers | View raw


On Sun, May 8, 2016 at 9:54 AM, Jim Dodgen <jim@dodgen.us> wrote:
> The empty token is needed but useless, it is arg[0] most people just repeat
> the program name

Far from useless. It's how a process learns its own name, and yes,
repeating the image name is the most common way to provide that.

> One other observation it looks as Popen behaves the same way as my fork
> exec would

Indeed. In fact, I would strongly recommend never using an explicit
fork/exec from Python - always use subprocess or equivalent. On
non-Unix platforms, fork/exec may not be available, but subprocess can
use other methods of invoking programs.

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: redirecting stdout and stderr to /dev/null Chris Angelico <rosuav@gmail.com> - 2016-05-08 10:10 +1000

csiph-web