Message269830
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. |
|
Date |
User |
Action |
Args |
2016-07-05 15:50:26 | klo.uo | set | recipients:
+ klo.uo |
2016-07-05 15:50:26 | klo.uo | set | messageid: <1467733826.6.0.356479348318.issue27457@psf.upfronthosting.co.za> |
2016-07-05 15:50:26 | klo.uo | link | issue27457 messages |
2016-07-05 15:50:25 | klo.uo | create | |
|