Author ncoghlan
Recipients Alexander.Belopolsky, Arfrever, asvetlov, brian.curtin, csernazs, cvrebert, dstanek, eric.araujo, eric.smith, giampaolo.rodola, holdenweb, larry, ncoghlan, r.david.murray, vstinner
Date 2012-04-01.03:28:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333250906.43.0.133200637509.issue7839@psf.upfronthosting.co.za>
In-reply-to
Content
For the record, my shell access convenience API proposal is in issue 13238.

I'm not going to push that for 3.3 though - convenient shell access from Python is currently an area with a lot of active third party development, so I think it's worthwhile continuing to be conservative on this topic rather than rushing ahead with blessing any particular approach for stdlib inclusion.

To get back to RDM's specific proposal (that shell=True/False should constrain the acceptable types for the first positional argument to str/list respectively), I'm -1 on the idea.

The reason I'm not a fan is the fact that, with "shell=True", you can use the *executable* argument to Popen to select a non-default shell. At that point, passing a list can make sense, even if it isn't useful for the default shell. On Windows, the implicit invocation of list2cmdline can already make this a useful thing to do.

For the other way around, passing a string with "shell=False" can be a straightforward way to launch GUI applications from a script. Specifying executable directly can also have an effect on this case, too (although I forget the consequences)

Now, what may make sense is to provide separate Popen.exec and Popen.shell *class methods* that correspond to shell=False and shell=True with the stricter type checking on the first argument (i.e. Popen.exec only accepts a list, POpen.shell only accepts a string).

Another advantage of adding the two new class methods is that it would give us the opportunity to *change some of the defaults* (e.g making close_fds=True the default behaviour).
History
Date User Action Args
2012-04-01 03:28:26ncoghlansetrecipients: + ncoghlan, holdenweb, csernazs, vstinner, dstanek, larry, eric.smith, giampaolo.rodola, eric.araujo, Arfrever, r.david.murray, brian.curtin, cvrebert, asvetlov, Alexander.Belopolsky
2012-04-01 03:28:26ncoghlansetmessageid: <1333250906.43.0.133200637509.issue7839@psf.upfronthosting.co.za>
2012-04-01 03:28:05ncoghlanlinkissue7839 messages
2012-04-01 03:28:05ncoghlancreate