bitbake: command: add error to return of runCommand
authorChristopher Larson <chris_larson@mentor.com>
Mon, 29 Oct 2012 20:01:23 +0000 (13:01 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 1 Nov 2012 11:46:22 +0000 (11:46 +0000)
commit13b5f0d125e138bac77416e23adc164bc6a7e826
tree1b7252e506939b6aff33016a14df1bfaac06b59e
parentfd982c3d9796f01cc5d906d171c5ec202fd1927e
bitbake: command: add error to return of runCommand

Currently, command.py can return an error message from runCommand, due to
being unable to run the command, yet few of our UIs (just hob) can handle it
today. This can result in seeing a TypeError with traceback in certain rare
circumstances.

To resolve this, we need a clean way to get errors back from runCommand,
without having to isinstance() the return value. This implements such a thing
by making runCommand also return an error (or None if no error occurred).

As runCommand now has a method of returning errors, we can also alter the
getCmdLineAction bits such that the returned value is just the action, not an
additional message. If a sync command wants to return an error, it raises
CommandError(message), and the message will be passed to the caller
appropriately.

Example Usage:

    result, error = server.runCommand(...)
    if error:
        log.error('Unable to run command: %s' % error)
        return 1

(Bitbake rev: 717831b8315cb3904d9b590e633000bc897e8fb6)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/command.py
bitbake/lib/bb/server/process.py
bitbake/lib/bb/ui/crumbs/hobeventhandler.py
bitbake/lib/bb/ui/depexp.py
bitbake/lib/bb/ui/goggle.py
bitbake/lib/bb/ui/knotty.py
bitbake/lib/bb/ui/ncurses.py