Change in osmo-gsm-tester[master]: process: Make sending signals (kill) externally visible

Holger Freyther gerrit-no-reply at lists.osmocom.org
Mon Mar 4 10:44:16 UTC 2019


Holger Freyther has submitted this change and it was merged. ( https://gerrit.osmocom.org/13086 )

Change subject: process: Make sending signals (kill) externally visible
......................................................................

process: Make sending signals (kill) externally visible

Change-Id: I87bba8a8c467ba5936e0b6604d8abb9432e5e7a8
---
M src/osmo_gsm_tester/process.py
1 file changed, 9 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 1e53aba..3050f83 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -145,6 +145,12 @@
     def send_signal(self, sig):
         os.kill(self.process_obj.pid, sig)
 
+    def kill(self, sig):
+        """Kills the process with the given signal and remembers it."""
+        self.log('Terminating (%s)' % sig.name)
+        self.send_signal(sig)
+        self.killed = sig
+
     def terminate(self):
         if self.process_obj is None:
             return
@@ -153,23 +159,17 @@
 
         while True:
             # first try SIGINT to allow stdout+stderr flushing
-            self.log('Terminating (SIGINT)')
-            self.send_signal(signal.SIGINT)
-            self.killed = signal.SIGINT
+            self.kill(signal.SIGINT)
             if self._poll_termination():
                 break
 
             # SIGTERM maybe?
-            self.log('Terminating (SIGTERM)')
-            self.send_signal(signal.SIGTERM)
-            self.killed = signal.SIGTERM
+            self.kill(signal.SIGTERM)
             if self._poll_termination():
                 break
 
             # out of patience
-            self.log('Terminating (SIGKILL)')
-            self.send_signal(signal.SIGKILL)
-            self.killed = signal.SIGKILL
+            self.kill(signal.SIGKILL)
             break;
 
         self.process_obj.wait()

-- 
To view, visit https://gerrit.osmocom.org/13086
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I87bba8a8c467ba5936e0b6604d8abb9432e5e7a8
Gerrit-Change-Number: 13086
Gerrit-PatchSet: 2
Gerrit-Owner: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190304/4c138007/attachment.html>


More information about the gerrit-log mailing list