Commit 9226758e authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Add returncode as optional return to lvcnrcheck helper

parent 6656a0ff
......@@ -24,7 +24,7 @@ import numpy as np
from lvcnrpy.Sim import Sim
def lvcnrcheck(args):
def lvcnrcheck(args, returncode=False):
"""Software API adapter for `lvcnrcheck`
API to `lvcnrcheck` since `lvcnrcheck` only provides a CLI.
......@@ -35,16 +35,25 @@ def lvcnrcheck(args):
List of command line argument to call `lvcnrcheck` with. Typically this
should end with a path to a HDF5 file to validate against the LVCNR
Wavform Reopsitory format specification.
returncode: bool (optional)
If `True`, return the return code of `lvcnrcheck`. Default is `False`.
Returns
-------
output: str
Standard output that would be recived from calling `lvcnrcheck` through
the CLI interface with `h5Path`.
(output, returncode): (str, bool)
If `returncode` then return the standard output and the return code of
`lvcnrcheck` as a tuple.
"""
pipe = Popen(['lvcnrcheck']+args, stdout=PIPE, stderr=STDOUT)
output = pipe.communicate()[0]
return output
if not returncode:
return output
else:
return (output, pipe.returncode)
def createValidSim():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment