emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Redirecting stderr to stdout with babel/shell


From: Karl Voit
Subject: Re: [O] Redirecting stderr to stdout with babel/shell
Date: Sun, 11 Jan 2015 19:31:00 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

* John Kitchin <address@hidden> wrote:
> Karl Voit <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]