[spp] [PATCH 1/3] spp: fix bug of precmd

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Tue Oct 3 12:42:12 CEST 2017


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

In precmd function, command log is not recorded if it is
'playback' to avoid illegal action when the log is loaded.
However, 'bye' should be also excluded from the log because
spp.py is terminated immediately if the log is loaded.
This change for adding a condition for command logging.

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

diff --git a/src/spp.py b/src/spp.py
index 68b3a3f..4aa0c62 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -503,8 +503,9 @@ class Shell(cmd.Cmd):
 
     def precmd(self, line):
         line = line.lower()
-        if self.recorded_file and 'playback' not in line:
-            print(line, file=self.recorded_file)
+        if self.recorded_file:
+            if not (('playback' in line) or ('bye' in line)):
+                print(line, file=self.recorded_file)
         return line
 
     def close(self):
-- 
2.13.1



More information about the spp mailing list