From dae920e245ab9a539907740f41fac4db3028abe3 Mon Sep 17 00:00:00 2001 From: Thomas Nixon Date: Sun, 18 Feb 2018 18:38:38 +0000 Subject: [PATCH] Fix #1191, lockup after running external command. This is caused by urwid/urwid#285; stopping and starting the whole mainloop rather than just the screen works around this, but that's only available in newer urwid versions. This also affected the :pipeto and :pyshell commands. --- alot/commands/globals.py | 8 ++++---- alot/commands/thread.py | 8 ++++---- setup.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 4c678afca..e8721758f 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -284,9 +284,9 @@ def thread_code(*_): d = threads.deferToThread(thread_code) d.addCallback(afterwards) else: - ui.mainloop.screen.stop() + ui.mainloop.stop() ret = thread_code() - ui.mainloop.screen.start() + ui.mainloop.start() # make sure urwid renders its canvas at the correct size ui.mainloop.screen_size = None @@ -348,9 +348,9 @@ class PythonShellCommand(Command): repeatable = True def apply(self, ui): - ui.mainloop.screen.stop() + ui.mainloop.stop() code.interact(local=locals()) - ui.mainloop.screen.start() + ui.mainloop.start() @registerCommand(MODE, 'repeat') diff --git a/alot/commands/thread.py b/alot/commands/thread.py index dcce2edb2..ef112ef68 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -769,8 +769,8 @@ def apply(self, ui): if self.notify_stdout: ui.notify(out) else: - logging.debug('stop urwid screen') - ui.mainloop.screen.stop() + logging.debug('stop urwid mainloop') + ui.mainloop.stop() logging.debug('call: %s', self.cmd) # if proc.stdout is defined later calls to communicate # seem to be non-blocking! @@ -779,8 +779,8 @@ def apply(self, ui): # stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = proc.communicate(mail) - logging.debug('start urwid screen') - ui.mainloop.screen.start() + logging.debug('start urwid mainloop') + ui.mainloop.start() if err: ui.notify(err, priority='error') return diff --git a/setup.py b/setup.py index f20c5cba4..3bf8706eb 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ }, install_requires=[ 'notmuch>=0.13', - 'urwid>=1.1.0', + 'urwid>=1.3.0', 'urwidtrees>=1.0', 'twisted>=10.2.0', 'python-magic',