redirecting stdout and stderr to /dev/null

Chris Angelico rosuav at gmail.com
Sat May 7 20:10:07 EDT 2016


On Sun, May 8, 2016 at 9:54 AM, Jim Dodgen <jim at 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



More information about the Python-list mailing list