Bruno Barbier <brubar...@gmail.com> writes: >> WRT M-x shell, feel free to submit a bug report. I mostly pointed that >> the problem with M-x shell is not the problem you originally ran to. It >> is a different problem (also, we ran into it in the past). > > FWIW, M-x shell differs from what a plain terminal is doing (xterm, in > my case), but, I do prefer 'M-x shell' behavior: it allows me to copy > multiple lines, getting the same results as when I type them manually, > or copy them line by line. My xterm doesn't seem to allow me to do that.
The behavior of M-x shell can indeed be made use of. However, this particular difference with xterm, AFAIU, is not documented - unaware users may be surprised. The situation is worse with Org shell blocks - users naturally expect script-like behavior (even for :session), but run into edge cases like this and get confused. We should either document the caveats, or, preferably, make the behavior more consistent with expectations. At least, by default. That's why I think that filing a bug report makes sense from Org mode project point of view. > It looks like it is a known SSH "feature" (see > https://unix.stackexchange.com/a/688024): > > #+begin_src bash :results output > seq 1000000 | (ssh phone sleep 1; wc -l) > #+end_src > > #+RESULTS: > : 675173 > ... > IMHO, what ob-shell is doing today seems a valid way of evaluating > source blocks (and it seems to have been like that for a long time). It > should probably be documented somewhere, so that users know how to write > their source blocks, or switch to another way, like adding a :cmdline > parameter as mentionned in this thread. And, as Max demonstrated, this ssh feature only works with bash, but not necessarily other shells. Moreover, "-n" option that disables the above may depend on ssh configuration (see StdinNull in man 5 ssh_config). So, I believe that it only leads to confusion, even if we try to document it. __By default__, Org should produce more expected behavior - what users would get from running a script file rather than from redirecting stdin. We can optionally leave the stdin redirection as an option to be used by the users who understand the peculiarities. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>