diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-16 15:58:00 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-16 15:58:00 +0100 |
commit | 11d519a7c3771c8a01ae45cb26803963d6bdb306 (patch) | |
tree | 7e13c5d87e7191361217ae83b2b71066e40bc7fb /alot/commands/globals.py | |
parent | ab194e7c0a763a71bba442a8871048bbf48cc185 (diff) |
fix ! for shellescape and error handling
Diffstat (limited to 'alot/commands/globals.py')
-rw-r--r-- | alot/commands/globals.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index fba07d93..0da6ba18 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -117,8 +117,11 @@ class ExternalCommand(Command): callerbuffer = ui.current_buffer def afterwards(data): - if callable(self.on_success) and data == 'success': - self.on_success() + if data == 'success': + if callable(self.on_success): + self.on_success() + else: + ui.notify(data, priority='error') if self.refocus and callerbuffer in ui.buffers: ui.logger.info('refocussing') ui.buffer_focus(callerbuffer) @@ -142,9 +145,11 @@ class ExternalCommand(Command): cmd) cmd = cmd.encode('utf-8', errors='ignore') ui.logger.info('calling external command: %s' % cmd) - returncode = subprocess.call(shlex.split(cmd)) - if returncode == 0: - os.write(write_fd, 'success') + try: + if 0 == subprocess.call(shlex.split(cmd)): + os.write(write_fd, 'success') + except OSError, e: + os.write(write_fd, str(e)) if self.in_thread: thread = threading.Thread(target=thread_code) |