[Git][NTPsec/ntpsec][master] Simplify ntpq's do_EOF and do_exit functions

Matt Selsky gitlab at mg.gitlab.com
Sun May 14 19:44:28 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
382b70e0 by Matt Selsky at 2017-05-14T19:33:05+00:00
Simplify ntpq's do_EOF and do_exit functions

>From the help for Cmd.cmdloop:

"This method will return when the postcmd() method returns a true value. The
stop argument to postcmd() is the return value from the command’s corresponding
do_*() method."

So any do_*() method that returns True will exit cleanly.

- - - - -


1 changed file:

- ntpclients/ntpq


Changes:

=====================================
ntpclients/ntpq
=====================================
--- a/ntpclients/ntpq
+++ b/ntpclients/ntpq
@@ -453,8 +453,7 @@ usage: units
     def do_EOF(self, _unused):
         "exit ntpq"
         self.say("\n")
-        self.session.close()
-        raise SystemExit(0)
+        return True
 
     def do_timeout(self, line):
         "set the primary receive time out"
@@ -680,8 +679,7 @@ usage: debug [no|more|less|n]
 
     def do_exit(self, line):
         "exit ntpq"
-        self.session.close()
-        raise SystemExit(0)
+        return True
 
     def help_exit(self):
         self.say("""\



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/382b70e0cab580bda5fed298976fc1a5ff074228

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/382b70e0cab580bda5fed298976fc1a5ff074228
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170514/c8161e8f/attachment.html>


More information about the vc mailing list