xonsh icon indicating copy to clipboard operation
xonsh copied to clipboard

Windows: ConPTY support should be improved

Open wight554 opened this issue 3 years ago • 5 comments

xonfig

+------------------+-----------------+ | xonsh | 0.9.27 | | Python | 3.9.1 | | PLY | 3.11 | | have readline | False | | prompt toolkit | 3.0.18 | | shell type | prompt_toolkit | | pygments | 2.8.1 | | on posix | False | | on linux | False | | on darwin | False | | on windows | True | | on cygwin | False | | on msys2 | False | | is superuser | False | | default encoding | utf-8 | | xonsh encoding | utf-8 | | encoding errors | surrogateescape | | on jupyter | False | | jupyter kernel | None | | xontrib | [] | +------------------+-----------------+

Expected Behavior

ConPTY support should (?) be improved I know windows isn't main platform for xonsh but it feels like a best shell for it in terms of integrity and stability

Current Behavior

TL; DR; ConPTY seems to be nightmare for unix like shells See these reference: https://github.com/microsoft/terminal/issues/364 https://github.com/zsh-users/zsh-syntax-highlighting/issues/789

The particular issue with xonsh is easily replicable if you run npm run test in app created by create-react-app It'll just crash and can cause huge memory leaks that lead to system unresponsiveness Most npm commands seem to cause crashes while running xonsh with conpty backend (fun fact it seems to be working in Windows terminal but that's it, Alacritty/VS Code/etc just crash) mintty/winpty works just fine

Traceback (if applicable)

I couldn't get traceback, logs are being empty no matter how many times I reproduce the bug (and consoles just crashes)

Steps to Reproduce

In VS Code/CMD/Powershell terminal:

xonsh
npx create-react-app my-app
cd my-app
npm i (might crash here)
npm run test

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

wight554 avatar Apr 19 '21 22:04 wight554

Pinging @melund in case he has any thoughts here.

Could this be a prompt toolkit issue?

gforsyth avatar Apr 20 '21 16:04 gforsyth

I haven't experienced this. I mostly use windows terminal, and haven't used xonsh much the 5 month.

Is it only when you run npm programs?

melund avatar Apr 20 '21 17:04 melund

Well that's the most noticable way I could reproduce it Probably other packages that can override whole shell may cause crashes

wight554 avatar Apr 20 '21 17:04 wight554

got more info the reason it doesn't crash on windows terminal is that it has newer conpty https://github.com/alacritty/alacritty/pull/4501#issuecomment-735445218 (here explanation) it might be fixed in windows upstream some day but workarounding it would be much better

wight554 avatar Apr 21 '21 22:04 wight554

~Hey @wight554 -- I believe that at the core, this is a prompt_toolkit issue, in that we're relying on prompt_toolkit for the PTY handling and they haven't had time to add in support for conpty~

I'm not sure the above is correct now. Happy for folks to chime in, but I don't have any windows boxes to work on in any case.

gforsyth avatar Apr 22 '21 14:04 gforsyth