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
This commit is contained in:
parent
315b078fe8
commit
20087ad8c4
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue