Change in osmo-gsm-tester[master]: process: Make sure sync process is terminated if ogt is stopped

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Oct 25 16:32:46 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11459


Change subject: process: Make sure sync process is terminated if ogt is stopped
......................................................................

process: Make sure sync process is terminated if ogt is stopped

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



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

diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 534cdba..fb5c6f6 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -236,25 +236,26 @@
                                      ' '.join(self.popen_args))]
         self.dbg(self.popen_args, dir=self.run_dir, conf=self.popen_kwargs)
 
+def run_proc_sync(proc):
+    try:
+        proc.launch()
+        proc.wait()
+    except Exception as e:
+        proc.terminate()
+        raise e
+    if proc.result != 0:
+        log.ctx(proc)
+        raise log.Error('Exited in error')
 
 def run_local_sync(run_dir, name, popen_args):
     run_dir =run_dir.new_dir(name)
     proc = Process(name, run_dir, popen_args)
-    proc.launch()
-    proc.wait()
-    if proc.result != 0:
-        log.ctx(proc)
-        raise log.Error('Exited in error')
+    run_proc_sync(proc)
 
 def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, remote_cwd=None):
     run_dir = run_dir.new_dir(name)
-    proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd,
-                                 popen_args)
-    proc.launch()
-    proc.wait()
-    if proc.result != 0:
-        log.ctx(proc)
-        raise log.Error('Exited in error')
+    proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, popen_args)
+    run_proc_sync(proc)
 
 def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path):
     run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % (remote_user, remote_addr, remote_path)))

-- 
To view, visit https://gerrit.osmocom.org/11459
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: Iecdac96ea576a312be2a6c6b6799e249074687ef
Gerrit-Change-Number: 11459
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181025/32ccdcc6/attachment.htm>


More information about the gerrit-log mailing list