diff --git a/psh/console.py b/psh/console.py index cf649d7..491440f 100644 --- a/psh/console.py +++ b/psh/console.py @@ -2,7 +2,6 @@ import atexit import code import os import readline -import shlex from psh.commands import registered_cmds @@ -23,7 +22,7 @@ def parse_cmd(potential_cmd): if args: args = args[1:] if cmd_name not in registered_cmds: - return "RawCommand({})".format(shlex.split(potential_cmd)) + return "RawCommand('{}')".format(potential_cmd) else: cls = registered_cmds[cmd_name].__name__ return "{0}({1})".format(cls, str(args)) diff --git a/psh/raw_commands.py b/psh/raw_commands.py index 6777bc1..1d61444 100644 --- a/psh/raw_commands.py +++ b/psh/raw_commands.py @@ -1,3 +1,5 @@ +import shlex + from psh.formatters import Printer from psh.commands import BaseCommand @@ -15,7 +17,7 @@ class RawCommand(BaseCommand): input_generator = self.get_input_generator() import subprocess try: - p = subprocess.Popen(self.cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + p = subprocess.Popen(shlex.split(self.cmd), stdin=subprocess.PIPE, stdout=subprocess.PIPE) def make_output_generator(): input_str = b"" for line in input_generator: