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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Fri Mar 1 08:15:12 UTC 2019


Holger Freyther has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/86/13086/1

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: newchange
Gerrit-Change-Id: I87bba8a8c467ba5936e0b6604d8abb9432e5e7a8
Gerrit-Change-Number: 13086
Gerrit-PatchSet: 1
Gerrit-Owner: Holger Freyther <holger at freyther.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190301/1ac113bf/attachment.htm>


More information about the gerrit-log mailing list