Skip to content

Instantly share code, notes, and snippets.

@JaimieMurdock
Created July 27, 2016 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaimieMurdock/43963ddab766155dd480dfeec54fa832 to your computer and use it in GitHub Desktop.
Save JaimieMurdock/43963ddab766155dd480dfeec54fa832 to your computer and use it in GitHub Desktop.
Helper function for quoting command line arguments.
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