This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author klo.uo
Recipients klo.uo
Date 2016-07-05.15:50:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467733826.6.0.356479348318.issue27457@psf.upfronthosting.co.za>
In-reply-to
Content
Example code:

========================================
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shlex
>>> cmd = ["pwd", "&&", "ls"]
>>> ' '.join(shlex.quote(arg) for arg in cmd)
"pwd '&&' ls"
>>>
========================================

Double ampersants is quoted, and if this command string is passed to Popen or pasted in shell it would fail.


OTOH, Windows so-so compatible list2cmdline:

========================================
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> cmd = ["cd", "&&", "dir"]
>>> subprocess.list2cmdline(cmd)
'cd && dir'
>>>
========================================

behaves correctly.
History
Date User Action Args
2016-07-05 15:50:26klo.uosetrecipients: + klo.uo
2016-07-05 15:50:26klo.uosetmessageid: <1467733826.6.0.356479348318.issue27457@psf.upfronthosting.co.za>
2016-07-05 15:50:26klo.uolinkissue27457 messages
2016-07-05 15:50:25klo.uocreate