From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mogw0139.ocn.ad.jp (mogw0139.ocn.ad.jp [118.23.109.113]) by dpdk.org (Postfix) with ESMTP id 74725377E for ; Tue, 18 Jul 2017 20:58:04 +0200 (CEST) Received: from mf-smf-ucb005.ocn.ad.jp (mf-smf-ucb005.ocn.ad.jp [153.149.231.4]) by mogw0139.ocn.ad.jp (Postfix) with ESMTP id 810318028F; Wed, 19 Jul 2017 03:58:02 +0900 (JST) Received: from mf-smf-ucb005.ocn.ad.jp (mf-smf-ucb005 [153.149.231.4]) by mf-smf-ucb005.ocn.ad.jp (Postfix) with ESMTP id 698A460709; Wed, 19 Jul 2017 03:58:02 +0900 (JST) Received: from ntt.pod01.mv-mta-ucb020 (mv-mta-ucb020.ocn.ad.jp [153.149.142.83]) by mf-smf-ucb005.ocn.ad.jp (Switch-3.3.4/Switch-3.3.4) with ESMTP id v6IIvpPu018147; Wed, 19 Jul 2017 03:58:02 +0900 Received: from smtp.ocn.ne.jp ([153.149.227.165]) by ntt.pod01.mv-mta-ucb020 with id mJy11v0013akymp01Jy1Qq; Tue, 18 Jul 2017 18:58:02 +0000 Received: from localhost.localdomain (p3469148-ipngn19901marunouchi.tokyo.ocn.ne.jp [153.229.6.148]) by smtp.ocn.ne.jp (Postfix) with ESMTPA; Wed, 19 Jul 2017 03:58:01 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org Cc: ferruh.yigit@intel.com, sy.jong.choi@intel.com, Yasufumi Ogawa Date: Wed, 19 Jul 2017 03:57:26 +0900 Message-Id: <20170718185729.76668-2-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170718185729.76668-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20170718185729.76668-1-ogawa.yasufumi@lab.ntt.co.jp> Subject: [spp] [PATCH 2/5] Remove unwanted spaces from the sec command X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jul 2017 18:58:05 -0000 From: Yasufumi Ogawa spp controller returns invalid command error if "sec n;..." contains unwanted space chars. Remove unwanted spaces from the command to avoid error. Signed-off-by: Yasufumi Ogawa --- src/spp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spp.py b/src/spp.py index 01aed23..c383820 100755 --- a/src/spp.py +++ b/src/spp.py @@ -10,6 +10,8 @@ import getopt import select import socket import sys +import re +#import pdb; pdb.set_trace() class GrowingList(list): """GrowingList""" @@ -309,7 +311,10 @@ class Shell(cmd.Cmd): def do_sec(self, arg): """Send command to secondary process""" - cmds = arg.split(';') + # remove unwanted space to avoid invalid command error + tmparg = re.sub(r'\s+', " ", arg) + tmparg = re.sub(r'\s?;\s?', ";", tmparg) + cmds = tmparg.split(';') if len(cmds) < 2: print ("error") elif str.isdigit(cmds[0]): @@ -370,6 +375,7 @@ class Shell(cmd.Cmd): self.close() return True + def main(argv): """main""" @@ -381,6 +387,7 @@ def main(argv): except getopt.GetoptError: print ('spp.py -p -s ') sys.exit(2) + for opt, arg in opts: if opt in ("-h", "--help"): print ('spp.py -p -s ') @@ -429,5 +436,6 @@ def main(argv): secondary_sock.shutdown(socket.SHUT_RDWR) secondary_sock.close() + if __name__ == "__main__": main(sys.argv[1:]) -- 2.13.1