1

Org Babel (Shell) in a session ends up truncating output from the shell.

MWE:

test.py:

#!/usr/bin/env python3

print("""
Stats: CPU Busy 24 (100.00%)
Stats: IO Busy  15 (62.50%)

Stats: Total Time Busy 24 (100.00%)
""")

test.org:

#+begin_src shell :session test :results output
./test.py
#+end_src

#+RESULTS:
 : 
 : )
 : )
 : )

It seems like it ignores everything before %, which is rather surprising. I tried removing the %, and everything worked fine.

Tested on Emacs 27.1 and Emacs master, Ubuntu Jammy (22.04), using emacs -q.

Edit: Also tested on Termux, Emacs 28.3. Behaviour is replicated. In the process, also found a better MWE

#+begin_src shell :session test :results output
echo "Hello world #"
#+end_src

#+RESULTS:
: 
4
  • I cannot reproduce this either in its python form or in the simplified form: shell, bash, ksh, zsh all produce the expected output. What version of Org mode were you running?
    – NickD
    Commented May 1 at 3:10
  • is there any reason, you are using :session test. Because, i see only one code block here for which session is not needed.
    – Saravana
    Commented May 1 at 4:52
  • @Saravana it was part of a larger document, where I was using sessions to manage different contexts
    – mon
    Commented May 2 at 20:35
  • @NickD not quite sure. It has been some quite some time, and I have updated my setup a couple of times since asking.
    – mon
    Commented May 2 at 20:37

1 Answer 1

1

The solution turned out to be specifying the name of the shell.

#+begin_src bash :session test :results output
echo "Hello world #"
#+end_src

#+RESULTS:
: Hello world #

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.