[PATCH 3/3] restore CalledProcessError handling

Will Woods wwoods at redhat.com
Wed Aug 22 20:22:26 UTC 2012


On Wed, 2012-08-22 at 13:01 -0700, Brian C. Lane wrote:

> +    dev = execWithCapture("losetup", ["--find", "--show", outfile], raise_err=True)
...
> +    execWithRedirect(mount[0], mount[1:], raise_err=True)

I find this usage a bit silly. Is there some reason we can't just add
convenience methods like:

    def runcmd(cmd, **kwargs):
        kwargs['raise_err'] = True
        return execWithRedirect(cmd[0], cmd[1:], **kwargs)

    def cmdoutput(cmd, **kwargs):
        kwargs['raise_err'] = True
        return execWithCapture(cmd[0], cmd[1:], **kwargs)

and change all these increasingly-messy calls to execWithRedirect to
something simpler and closer their original forms? Like:

    dev = cmdoutput(["losetup", "--find", "--show", outfile])
    runcmd(mount)

-w



More information about the anaconda-patches mailing list