Commits

Kirill Simonov committed b0f3706

Split command line using shlex.

  • Participants
  • Parent commits 5af962e

Comments (0)

Files changed (1)

 import subprocess
 import traceback
 import difflib
+import shlex
 
 
 def is_attribute(text, attr_re=re.compile(r'^[A-Za-z_][0-9A-Za-z_]*$')):
         # Prepare the command.
         command = self.input.sh
         if isinstance(command, str):
-            command = command.split()
+            try:
+                command = shlex.split(command)
+            except ValueError:
+                # Let `Popen` complain about it.
+                command = [command]
         environ = None
         if self.input.environ:
             environ = os.environ.copy()