From f3acb135e723258bd4b6072d5737d52e13d47054 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Sun, 27 Jan 2013 15:41:20 -0800 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/server/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bitbake/lib/bb/server') diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index ba9133639d..3ae9ede6b6 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py @@ -48,7 +48,7 @@ class ServerCommunicator(): if self.connection.poll(.5): return self.connection.recv() else: - return None + return None, "Timeout while attempting to communicate with bitbake server" except KeyboardInterrupt: pass -- cgit v1.2.3-54-g00ecf