Moved shlex import to the raw command module

Makes much more sense to do the parsing at that point.
This commit is contained in:
Ian Adam Naval 2015-02-26 18:19:12 -05:00
parent 1d7d2d8446
commit 781ae4b99c
2 changed files with 4 additions and 3 deletions

View File

@ -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))

View File

@ -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: