From 39b2c854d4dd22153a18c925c60c92ceea3fd1d0 Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Sat, 1 Apr 2006 05:01:42 +0000 Subject: [PATCH] Since gajim-remote is a user script and the output of which is often parsed I think it unwise to include the "inconsistent use of tabs and spaces in indentation" warning. Filtering stderr works, but may also filter out useful info. --- src/gajim-remote.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gajim-remote.py b/src/gajim-remote.py index 5cb77f259..48365c4c0 100755 --- a/src/gajim-remote.py +++ b/src/gajim-remote.py @@ -49,7 +49,7 @@ except: def send_error(error_message): '''Writes error message to stderr and exits''' print >> sys.stderr, error_message.encode(PREFERRED_ENCODING) - sys.exit() + sys.exit(1) try: import dbus @@ -226,7 +226,7 @@ class GajimRemote: print self.help_on_command(sys.argv[2]).encode(PREFERRED_ENCODING) else: print self.compose_help().encode(PREFERRED_ENCODING) - sys.exit() + sys.exit(0) self.init_connection() self.check_arguments() @@ -235,8 +235,13 @@ class GajimRemote: if self.argv_len < 3: send_error(_('Missing argument "contact_jid"')) - res = self.call_remote_method() - self.print_result(res) + try: + res = self.call_remote_method() + except exceptions.ServiceNotAvailable: + # At this point an error message has already been displayed + sys.exit(1) + else: + self.print_result(res) def print_result(self, res): ''' Print retrieved result to the output '''