13 Jun
2014
13 Jun
'14
7:55 a.m.
On Fri, Jun 13, 2014 at 12:11 PM, Nikolaus Rath <Nikolaus@rath.org> wrote:
Can someone describe an use case where shell=True actually makes sense at all?
It seems to me that whenever you need a shell, the argument's that you pass to it will be shell specific. So instead of e.g.
Popen('for i in `seq 42`; do echo $i; done', shell=True)
you almost certainly want to do
Popen(['/bin/sh', 'for i in `seq 42`; do echo $i; done'], shell=False)
because if your shell happens to be tcsh or cmd.exe, things are going to break.
Some features, while technically shell-specific, are supported across a lot of shells. You should be able to pipe output from one command into another in most shells, for instance. But yes, I generally don't use it. ChrisA