xonsh / xontrib-coreutils

Additional cross-platform core utilities that are implemented in xonsh.
2 stars 1 forks source link

coreutils + pipe doesn't work #4

Open ShellCode33 opened 5 years ago

ShellCode33 commented 5 years ago

Hi ! I'm new to xonsh and I find it truly amazing ! So first of all, thanks for doing it :)

I've enabed the coreutils plugin to speed things up a little, but I've noticed that when you redirect the stdout of a program into the stdin of a coreutils' function, it doesn't work at all and the shell keeps printing xonsh: readline() takes no keyword arguments until you ctrl+c. Command to reproduce : echo test | cat Of course, the following works great : echo test | /usr/bin/cat

I'm not familiar at all with xonsh code, but wouldn't it be possible to use the binary instead of the builtin when a pipe is used ? Or to consider stdin in coreutils ?

Here is my config :

+------------------+---------------------+
| xonsh            | 0.9.6               |
| Git SHA          | dabd4bd3            |
| Commit Date      | Jun 6 09:44:17 2019 |
| Python           | 3.7.3               |
| PLY              | 3.11                |
| have readline    | True                |
| prompt toolkit   | 2.0.9               |
| shell type       | prompt_toolkit2     |
| pygments         | 2.4.2               |
| on posix         | True                |
| on linux         | True                |
| distro           | unknown             |
| 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     |
+------------------+---------------------+

For community

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

ShellCode33 commented 5 years ago

I should probably create a new issue for this, but since it's still cat related... I found another bug : reading files from /proc doesn't show anything.

$ cat /proc/cpuinfo                                                                                                                                                                            
$ /usr/bin/cat /proc/cpuinfo                                                                                                                                                                   
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz

I have no clue why this is happening... Maybe something to do with the fact that /proc files are in RAM ?

laloch commented 5 years ago

Hi @ShellCode33, thanks for reporting! I can confirm both the issues. Could you please file another report for the second bug? It seems that cat is currently unable to fetch contents of zero-sized pseudo-files. These two are unrelated.

ShellCode33 commented 5 years ago

Done xonsh/xonsh#3182 !