aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester
diff options
context:
space:
mode:
authorAndre Puschmann <andre@softwareradiosystems.com>2020-06-19 15:44:34 +0200
committerAndre Puschmann <andre@softwareradiosystems.com>2020-06-30 14:22:47 +0200
commit20087ad8c46cbee43d83e25623dea39fcc30a074 (patch)
tree02e9a98a1b1653e4a58f3584139ee4f09e42cf44 /src/osmo_gsm_tester
parent315b078fe8142e9d609e65a05c12f3a5cc4f38ce (diff)
process: provide API to return filename for process output
this is useful if the caller handles the opening/reading from the file itself Change-Id: I5e70fd1593a5bc7902fa218aae6452103545e4e0
Diffstat (limited to 'src/osmo_gsm_tester')
-rw-r--r--src/osmo_gsm_tester/core/process.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/osmo_gsm_tester/core/process.py b/src/osmo_gsm_tester/core/process.py
index 1823a20..eaf8de7 100644
--- a/src/osmo_gsm_tester/core/process.py
+++ b/src/osmo_gsm_tester/core/process.py
@@ -321,12 +321,20 @@ class Process(log.Origin):
return self.process_obj is not None and self.result is None
def get_output(self, which):
+ ''' Read process output '''
+ path = self.get_output_file(which)
+ if path is None:
+ return None
+ with open(path, 'r') as f2:
+ return f2.read()
+
+ def get_output_file(self, which):
+ ''' Return filename for given output '''
v = self.outputs.get(which)
if not v:
return None
path, f = v
- with open(path, 'r') as f2:
- return f2.read()
+ return path
def get_output_tail(self, which, tail=10, prefix=''):
out = self.get_output(which)