[spp] [PATCH 1/3] controller: correct status update of processes

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed Feb 20 09:55:00 CET 2019


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

For getting the latest status of all of primary and secondaries, SPP CLI
calls init_spp_procs() after command run, but hook method is
inappripriate. This update is to change the hook from precmd() to
postcmd() to correct.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/controller/shell.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/controller/shell.py b/src/controller/shell.py
index 21543d1..e4685c7 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -70,7 +70,7 @@ class Shell(cmd.Cmd, object):
         """Initialize delegators of SPP processes.
 
         Delegators accept a command and sent it to SPP proesses. This method
-        is also called from `precmd()` method to update it to the latest
+        is also called from `postcmd()` method to update it to the latest
         status.
         """
 
@@ -101,6 +101,9 @@ class Shell(cmd.Cmd, object):
     # method and SPP CLI is terminated if it is True. It means that only
     # `do_bye` and  `do_exit` return True.
     def postcmd(self, stop, line):
+        if self.use_cache is False:
+            self.init_spp_procs()
+
         # TODO(yasufum) do not add to history if command is failed.
         if line.strip().split(' ')[0] not in self.HIST_EXCEPT:
             readline.write_history_file(self.hist_file)
@@ -217,9 +220,6 @@ class Shell(cmd.Cmd, object):
         It is called for checking a contents of command line.
         """
 
-        if self.use_cache is False:
-            self.init_spp_procs()
-
         if self.recorded_file:
             if not (
                     ('playback' in line) or
-- 
2.17.1



More information about the spp mailing list