This function is still being reviewed, and may be subject to changes to it’s signature and naming before uranium 1.0.
Uranium provides a convenience wrapper to interact with executables. This can handle some common scenarios, like execute a script and patch in the stdin, stdout, and stderr streams of the main Uranium processes.
def main(build): build.packages.install("py.test") build.executables.run(["py.test", "tests"])
Full API Reference¶
executables contains utility methods to interact with executables, in the context of the directory passed in.
run(args, link_streams=True, fail_on_error=True, subprocess_args=None)¶
execute an executable. by default, this method links the stdin, stdout, and stderr streams. in the case of an non-zero exit code, it will also raise a NonZeroExitCodeException.
for more customizability, subprocess.call() is a completely acceptable alternative. run() just has some defaults that are more suitable for builds.
returns a tuple of (exit_code, stdout, stderr)
args: a list of command line arguments
link_streams (default True): if set to true, stdin, stdout and stderr of the parent process will be used as the pipes for the child process.
fail_on_error: (default True): if set to true, raise an exception on a non-zero exit code.
subprocess_args: if set to a dictionary, these arguments will be passed into the popen statement.
def main(build): build.executables.run(["echo", ""hello world""])