* John Kitchin <johnrkitc...@gmail.com> wrote:
> Karl Voit <devn...@karl-voit.at> writes:
>
> Weird. It works for me on MacOSX with bash. Out of curiosity, did you
> try the source: 
> http://kitchingroup.cheme.cmu.edu/org/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks.org?

I did it now.

What I found out:

#+BEGIN_SRC sh
echo '#!/usr/bin/zsh
{
/usr/bin/zsh $1
} 2>&1
#end' > ~/src/misc/zsh_stderr_redirected_to_stdout.sh
chmod +x ~/src/misc/zsh_stderr_redirected_to_stdout.sh
cd ~/bin
ln -s ../src/misc/zsh_stderr_redirected_to_stdout.sh .
#+END_SRC

#+BEGIN_SRC elisp
(setq org-babel-sh-command "~/bin/zsh_stderr_redirected_to_stdout.sh")
#+END_SRC

... my old script from my previous posting:

#+BEGIN_SRC sh :results output
echo "testing stdout" >&1
echo "testing stderr" >&2
date -g
#+END_SRC

#+RESULTS:

... with empty additional buffer window. So not happy.

However with an additional "echo" at the end:

#+BEGIN_SRC sh :results output
echo "testing stdout" >&1
echo "testing stderr" >&2
date -g
echo
#+END_SRC

#+RESULTS:
: testing stdout
: testing stderr
: date: invalid option -- 'g'
: Try `date --help' for more information.
: 

... it works. :-O

Is there an issue with flushing stdout or something?

What is the explanation and the general rule?


Btw, the trick with tangling for writing the script file did not work on my
machine.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github


Reply via email to