Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 1/3] spp: fix bug of precmd
@ 2017-10-03 10:42 ogawa.yasufumi
  2017-10-03 10:42 ` [spp] [PATCH 2/3] spp: add record file check ogawa.yasufumi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2017-10-03 10:42 UTC (permalink / raw)
  To: spp; +Cc: gerald.rogers, sy.jong.choi, Yasufumi Ogawa

From: Yasufumi Ogawa <ogawa.yasufumi@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@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-29  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03 10:42 [spp] [PATCH 1/3] spp: fix bug of precmd ogawa.yasufumi
2017-10-03 10:42 ` [spp] [PATCH 2/3] spp: add record file check ogawa.yasufumi
2017-10-03 10:42 ` [spp] [PATCH 3/3] spp: change logger to optional ogawa.yasufumi
2017-11-29  1:35 ` [spp] [PATCH 1/3] spp: fix bug of precmd Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).