[spp] [PATCH 07/12] spp: fix bug for record command

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Tue Mar 6 11:39:24 CET 2018


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

Add entry of exit command to precmd() method to avoid be recorded.
If exit command is recorded, spp controller is terminated immediately
as log file is loaded from playback command.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/spp.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/spp.py b/src/spp.py
index 46c1613..db43ad5 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -671,7 +671,10 @@ class Shell(cmd.Cmd, object):
 
     def precmd(self, line):
         if self.recorded_file:
-            if not (('playback' in line) or ('bye' in line)):
+            if not (
+                    ('playback' in line) or
+                    ('bye' in line) or
+                    ('exit' in line)):
                 print(line, file=self.recorded_file)
         return line
 
@@ -773,8 +776,8 @@ class Shell(cmd.Cmd, object):
             return True
 
     def do_exit(self, args):
-        print('Thank you for using Soft Patch Panel')
         self.close()
+        print('Thank you for using Soft Patch Panel')
         return True
 
 
-- 
2.13.1



More information about the spp mailing list