From 1a92c51ddf6c3a3064d0a3d8cf80eb97a34aad74 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 16 Aug 2013 16:21:54 +0200 Subject: Fix an issue with shlex (well, sort of fix) --- src/common.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common.py b/src/common.py index 88c3d0ea..81f7b61a 100644 --- a/src/common.py +++ b/src/common.py @@ -238,12 +238,16 @@ def shell_split(st): ['toto', ''] >>> shell_split('"toto titi" toto ""') ['toto titi', 'toto', ''] + >>> shell_split('toto "titi') + ['toto', 'titi'] """ sh = shlex.shlex(st) ret = [] w = sh.get_token() while w and w[2] is not None: ret.append(w[2]) + if w[1] == len(st): + return ret w = sh.get_token() return ret @@ -277,6 +281,8 @@ def find_argument_quoted(pos, text): 1 >>> find_argument_quoted(8, '"toto" "titi tata') 1 + >>> find_argument_quoted(3, '"toto" "titi tata') + 0 >>> find_argument_quoted(18, '"toto" "titi tata" ') 2 """ -- cgit v1.2.3