xonsh icon indicating copy to clipboard operation
xonsh copied to clipboard

xontribs hang on piping output to grep, ag

Open alex-bender opened this issue 5 years ago • 5 comments

xonfig

+------------------+----------------------+
| xonsh            | 0.7.2                |
| Git SHA          | d9651fe8             |
| Commit Date      | Jul 30 10:58:07 2018 |
| Python           | 3.6.6                |
| PLY              | 3.11                 |
| have readline    | True                 |
| prompt toolkit   | 1.0.15               |
| shell type       | prompt_toolkit1      |
| pygments         | 2.2.0                |
| on posix         | True                 |
| on linux         | True                 |
| distro           | Ubuntu               |
| on darwin        | False                |
| on windows       | False                |
| on cygwin        | False                |
| on msys2         | False                |
| is superuser     | False                |
| default encoding | utf-8                |
| xonsh encoding   | utf-8                |
| encoding errors  | surrogateescape      |
+------------------+----------------------+

Expected Behavior

$ xontrib list | grep loaded should produce an output of loaded xontribs.

Current Behavior

xonsh hungs

Steps to Reproduce

$ xonsh
$ xontrib list | grep loaded

For community

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

alex-bender avatar Oct 02 '18 07:10 alex-bender

Thanks for opening this. I think the issue is that xontrib is unthreadable (for loading), and its output is being written before grep starts up. This is probably a general problem for all unthreadable callable aliases.

scopatz avatar Oct 05 '18 16:10 scopatz

@scopatz Hey, and could you please point me to the code where I can make it threadable, just to check that assumption? Thanks

alex-bender avatar Nov 18 '18 12:11 alex-bender

Sorry for the super slow reply @alex-bender - but I believe that it is this line: https://github.com/xonsh/xonsh/blob/master/xonsh/xontribs.py#L167

scopatz avatar Dec 19 '18 23:12 scopatz

It's ok! Glad that you found one.

alex-bender avatar Dec 20 '18 12:12 alex-bender

I can reproduce this by running xontrib list | grep loaded.

anki-code avatar Dec 06 '21 10:12 anki-code

Closed with the reference to https://github.com/xonsh/xonsh/issues/5317#issuecomment-2032017790

anki-code avatar Apr 02 '24 13:04 anki-code