diff mercurial/posix.py @ 36445:0cb09c322647

util: factor out shellsplit() function It turned out to be more than the simple posix=True|False flag, so let's introduce a platform function. I also made it py3 ready.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 21 Feb 2018 22:20:27 +0900
parents ed95758addf3
children ffa3026d4196
line wrap: on
line diff
--- a/mercurial/posix.py	Fri Feb 23 23:09:58 2018 +0900
+++ b/mercurial/posix.py	Wed Feb 21 22:20:27 2018 +0900
@@ -461,6 +461,10 @@
     else:
         return "'%s'" % s.replace("'", "'\\''")
 
+def shellsplit(s):
+    """Parse a command string in POSIX shell way (best-effort)"""
+    return pycompat.shlexsplit(s, posix=True)
+
 def quotecommand(cmd):
     return cmd