Merge pull request #2257 from xonsh/unthreadsig

Unthreadable xontrib command
This commit is contained in:
Morten Enemark Lund 2017-02-25 21:21:38 +01:00 committed by GitHub
commit 19e79e2999
2 changed files with 17 additions and 1 deletions

15
news/unthreadsig.rst Normal file
View file

@ -0,0 +1,15 @@
**Added:** None
**Changed:**
* The ``xontrib`` command is now flagged as unthreadable and will be
run on the main Python thread. This allows xontribs to set signal
handlers and other operations that require the main thread.
**Deprecated:** None
**Removed:** None
**Fixed:** None
**Security:** None

View file

@ -8,7 +8,7 @@ import functools
import importlib
import importlib.util
from xonsh.tools import print_color
from xonsh.tools import print_color, unthreadable
@functools.lru_cache(1)
@ -157,6 +157,7 @@ _MAIN_XONTRIB_ACTIONS = {
}
@unthreadable
def xontribs_main(args=None, stdin=None):
"""Alias that loads xontribs"""
if not args or (args[0] not in _MAIN_XONTRIB_ACTIONS and