mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Cygwin check in xonsh.platform, add to changelog
This commit is contained in:
parent
086b31b23e
commit
cea14abba0
4 changed files with 11 additions and 9 deletions
|
@ -18,6 +18,8 @@ Current Developments
|
|||
|
||||
* On Windows the default bash completions files ``$BASH_COMPLETIONS`` now points
|
||||
to the default location of the completions files used by 'Git for Windows'
|
||||
* On Cygwin, some tweaks are applied to foreign shell subprocess calls and the
|
||||
readline import, in order to avoid hangs on launch.
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from tempfile import NamedTemporaryFile
|
|||
from collections import MutableMapping, Mapping, Sequence
|
||||
|
||||
from xonsh.tools import to_bool, ensure_string
|
||||
from xonsh.platform import ON_WINDOWS
|
||||
from xonsh.platform import ON_WINDOWS, ON_CYGWIN
|
||||
|
||||
|
||||
COMMAND = """
|
||||
|
@ -244,10 +244,9 @@ def foreign_shell_data(shell, interactive=True, login=False, envcmd=None,
|
|||
elif currenv is not None:
|
||||
currenv = dict(currenv)
|
||||
try:
|
||||
# start new session to avoid hangs (doesn't work on Cygwin though)
|
||||
newsess = not (sys.platform == "cygwin")
|
||||
s = subprocess.check_output(cmd, stderr=subprocess.PIPE, env=currenv,
|
||||
start_new_session=newsess,
|
||||
# start new session to avoid hangs (doesn't work on Cygwin though)
|
||||
start_new_session=(not ON_CYGWIN),
|
||||
universal_newlines=True)
|
||||
except (subprocess.CalledProcessError, FileNotFoundError):
|
||||
if not safe:
|
||||
|
|
|
@ -28,8 +28,9 @@ ON_DARWIN = platform.system() == 'Darwin'
|
|||
ON_LINUX = platform.system() == 'Linux'
|
||||
""" ``True`` if executed on a Linux platform, else ``False``. """
|
||||
ON_WINDOWS = platform.system() == 'Windows'
|
||||
""" ``True`` if executed on a Windows platform, else ``False``. """
|
||||
|
||||
""" ``True`` if executed on a native Windows platform, else ``False``. """
|
||||
ON_CYGWIN = sys.platform == 'cygwin'
|
||||
""" ``True`` if executed on a Cygwin Windows platform, else ``False``. """
|
||||
ON_POSIX = (os.name == 'posix')
|
||||
""" ``True`` if executed on a POSIX-compliant platform, else ``False``. """
|
||||
|
||||
|
@ -202,7 +203,7 @@ if LINUX_DISTRO == 'arch':
|
|||
BASH_COMPLETIONS_DEFAULT = (
|
||||
'/etc/bash_completion',
|
||||
'/usr/share/bash-completion/completions')
|
||||
elif ON_LINUX:
|
||||
elif ON_LINUX or ON_CYGWIN:
|
||||
BASH_COMPLETIONS_DEFAULT = (
|
||||
'/usr/share/bash-completion',
|
||||
'/usr/share/bash-completion/completions')
|
||||
|
|
|
@ -14,7 +14,7 @@ from xonsh.base_shell import BaseShell
|
|||
from xonsh.ansi_colors import partial_color_format, color_style_names, color_style
|
||||
from xonsh.environ import partial_format_prompt, multiline_prompt
|
||||
from xonsh.tools import print_exception
|
||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS
|
||||
from xonsh.platform import HAS_PYGMENTS, ON_WINDOWS, ON_CYGWIN
|
||||
|
||||
if HAS_PYGMENTS:
|
||||
from xonsh import pyghooks
|
||||
|
@ -42,7 +42,7 @@ def setup_readline():
|
|||
import ctypes.util
|
||||
readline.set_completer_delims(' \t\n')
|
||||
# Cygwin seems to hang indefinitely when querying the readline lib
|
||||
if (not sys.platform == 'cygwin') and (not readline.__file__.endswith('.py')):
|
||||
if (not ON_CYGWIN) and (not readline.__file__.endswith('.py')):
|
||||
RL_LIB = lib = ctypes.cdll.LoadLibrary(readline.__file__)
|
||||
try:
|
||||
RL_COMPLETION_SUPPRESS_APPEND = ctypes.c_int.in_dll(
|
||||
|
|
Loading…
Add table
Reference in a new issue