Created
July 27, 2016 21:14
-
-
Save JaimieMurdock/43963ddab766155dd480dfeec54fa832 to your computer and use it in GitHub Desktop.
Helper function for quoting command line arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import platform | |
## Platform-independent command escape | |
## see http://stackoverflow.com/a/29597408 | |
if platform.system() == 'windows': | |
from subprocess import list2cmdline | |
quote_args = list2cmdline | |
else: | |
# POSIX | |
from pipes import quote | |
def quote_args(seq): | |
return ' '.join(quote(arg) for arg in seq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment