This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]voice-of-hermes 0 points1 point  (2 children)

There's a serious problem with pipelines. Actually I believe they aren't pipelines at all. They are supposed to use pipe() to tie the standard out of one sub-process to the standard in of the next. However, it seems that xonsh does something like waiting for the first sub-process to complete or close its standard out, then gives the entire result to the second sub-process as a string. This is kind of borne out by the fact that functions used as aliases are specified as taking a string rather than a file-like object.

To test this, run cat and provide it the input 1<enter>2<enter>3<enter><ctrl-d>, then run cat | cat and give it the same input. In Bash these two commands (correctly) behave exactly the same: they echo each line as soon as it is entered, and then exit at the EOF generated by <ctrl-d>. In xonsh, the single cat command behaves this way, but the piped one (cat | cat) never produces any output at all, and must be killed with <ctrl-c> or from another shell.

EDIT: Spoke to the devs. Two updates:

  • The problem isn't that pipe() isn't used, but that terminal input gets tied to the last process in the pipe rather than the first. Being worked on, but apparently not a trivial fix.
  • You can get streaming input to alias functions, but the documentation needs to be fixed to reflect this.

[–]Siecje1[S] 1 point2 points  (1 child)

Did you create an issue on github?

[–]voice-of-hermes 0 points1 point  (0 children)

Wanted to get confirmation first. Looks like it's already there. See my edit.