Hello, Try to execute a few times the following and see the output corrupted in the line:
#+BEGIN_EXAMPLE 1 packets transmitted, 1 received, 0% packet loss, time 0ms #+END_EXAMPLE #+PROPERTY: header-args:shell #+PROPERTY: header-args:shell+ :results output verbatim :wrap src text :session test #+NAME: ping #+BEGIN_SRC shell ping -c 1 127.0.0.1 #+END_SRC I tried to write a test (now with the :expected-result :failed), that hit the problem both in main and master (applies fine to both). I was not able to fix it, but hopefully the tests are still useful for somebody more knowledgeable! Thanks for you suggestion/fix! Best, Daniele
>From 897ae50cf055d459d741c90f8de94dd56a8eb3d9 Mon Sep 17 00:00:00 2001 From: Daniele Pizzolli <dan+...@toel.it> Date: Wed, 5 May 2021 17:00:28 +0200 Subject: [PATCH 1/1] Add disabled test for % in babel shell output --- testing/lisp/test-ob-shell.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/testing/lisp/test-ob-shell.el b/testing/lisp/test-ob-shell.el index 0aadb355d..a42cc3d77 100644 --- a/testing/lisp/test-ob-shell.el +++ b/testing/lisp/test-ob-shell.el @@ -106,6 +106,35 @@ ob-comint.el, which was not previously tested." "#+BEGIN_SRC sh :results output :var l='(1 2)\necho ${l}\n#+END_SRC" (org-trim (org-babel-execute-src-block)))))) +(ert-deftest ob-shell/percent-simple () + "Test percent in output." + (should + (equal "one 0% two\ntree 0% four" + (org-test-with-temp-text + "#+BEGIN_SRC bash :results output verbatim\necho one 0% two\necho tree 0% four\n#+END_SRC" + (org-trim (org-babel-execute-src-block))))) + (should + (equal "five 0% two\ntree 0% four" + (org-test-with-temp-text + "#+BEGIN_SRC bash :results output verbatim\necho five 0% two\necho tree 0% four\n#+END_SRC" + (org-trim (org-babel-execute-src-block)))))) + +(ert-deftest ob-shell/percent-session () + "Test percent in output for session. + +At the second iteration the string before % is dropped." + :expected-result :failed + (should + (equal "one 0% two\ntree 0% four" + (org-test-with-temp-text + "#+BEGIN_SRC bash :results output verbatim :session sess\necho one 0% two\necho tree 0% four\n#+END_SRC" + (org-trim (org-babel-execute-src-block))))) + (should + (equal "five 0% six\nseven 0% eight" + (org-test-with-temp-text + "#+BEGIN_SRC bash :results output verbatim :session sess\necho five 0% six\necho seven 0% eight\n#+END_SRC" + (org-trim (org-babel-execute-src-block)))))) + (provide 'test-ob-shell) ;;; test-ob-shell.el ends here -- 2.29.2