Skip to content

Commit

Permalink
Fix #1191, lockup after running external command.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tomjnixon committed Feb 19, 2018
1 parent 0b03f06 commit dae920e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions alot/commands/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions alot/commands/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit dae920e

Please sign in to comment.