From 406454fdd03c0984a7d4754da71a3e14f3562293 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 5 Aug 2013 19:45:08 +0200 Subject: Fix common.shell_split with empty strings --- src/common.py | 6 ++++++ src/shlex.py | 14 -------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/common.py b/src/common.py index 25950987..c438270f 100644 --- a/src/common.py +++ b/src/common.py @@ -232,6 +232,12 @@ def shell_split(st): >>> shell_split('"sdf 1" "toto 2"') ['sdf 1', 'toto 2'] + >>> shell_split('toto "titi"') + ['toto', 'titi'] + >>> shell_split('toto ""') + ['toto', ''] + >>> shell_split('"toto titi" toto ""') + ['toto titi', 'toto', ''] """ sh = shlex.shlex(st) ret = [] diff --git a/src/shlex.py b/src/shlex.py index 87a241ed..5b3c556c 100644 --- a/src/shlex.py +++ b/src/shlex.py @@ -95,20 +95,6 @@ class shlex: return tok # No pushback. Get a token. start, end, raw = self.read_token() - # Handle inclusions - # Maybe we got EOF instead? - while raw == self.eof: - if not self.filestack: - return self.eof - else: - self.pop_source() - start, end, raw = self.get_token() - # Neither inclusion nor EOF - if self.debug >= 1: - if raw != self.eof: - print("shlex: token=" + repr(raw)) - else: - print("shlex: token=EOF") return start, end, raw def read_token(self): -- cgit v1.2.3