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

2015-01-21 Thread Karl Voit
* Achim Gratz wrote: > Karl Voit writes: >> However with an additional "echo" at the end: > > You need to understand what you're doing or at least copy the code > exactly. The last line in my example is a colon ":" so that the shell > exit code is always zero. You're right. The only thing I di

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

2015-01-11 Thread Achim Gratz
Karl Voit writes: > However with an additional "echo" at the end: You need to understand what you're doing or at least copy the code exactly. The last line in my example is a colon ":" so that the shell exit code is always zero. If not, Babel will ignore the output since it interprets any non-ze

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

2015-01-11 Thread Karl Voit
* John Kitchin wrote: > Karl Voit 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

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

2015-01-11 Thread John Kitchin
Karl Voit 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 updated the web page with Achim's simpler solution. > * John Kitchin wrote: >> Check out

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

2015-01-11 Thread Karl Voit
* Achim Gratz wrote: > Karl Voit writes: >> echo "testing stderr with manual redirect" 2>&1 >&2 > > The last redirection ">&2" is nonsense, it only works because STDERR is > already reopened on STDOUT and redirection to the same file descriptor > is ignored. Absolutely right. Must have been a non

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

2015-01-11 Thread Achim Gratz
Karl Voit writes: > echo "testing stderr with manual redirect" 2>&1 >&2 The last redirection ">&2" is nonsense, it only works because STDERR is already reopened on STDOUT and redirection to the same file descriptor is ignored. And to solve your original problem: #+BEGIN_SRC sh :results output ex

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

2015-01-11 Thread Karl Voit
* John Kitchin wrote: > Check out this solution: > > http://kitchingroup.cheme.cmu.edu/blog/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks/ Hm. This does not work on my machine: Debian Wheezy GNU/Linux Testing the current satus (again): #+BEGIN_SRC sh :results output echo "testing stdou

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

2015-01-04 Thread John Kitchin
Check out this solution: http://kitchingroup.cheme.cmu.edu/blog/2015/01/04/Redirecting-stderr-in-org-mode-shell-blocks/ I think it does what you want, and uses the idea below. Samuel Wales writes: > hi karl, > > i always wrap as follows and it works for me. > > { > your code > } 2>&1 > : > >

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

2015-01-02 Thread Samuel Wales
hi karl, i always wrap as follows and it works for me. { your code } 2>&1 : the : eliminates fancy error handling. i find that much less confusing. samuel -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY c

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

2015-01-01 Thread Michael Brand
Hi Karl On Thu, Jan 1, 2015 at 5:27 PM, Karl Voit wrote: > Is there a similar method to re-direct the stderr of a shell script > to stdout as well? Not that I know of an other way than what you already demonstrated. Once I wrote a lengthy post with my opinion about stdout, stderr and the exit s

[O] Redirecting stderr to stdout with babel/shell

2015-01-01 Thread Karl Voit
Hi! I enjoyed [1] where John is describing the issue of vanishing stderr-messages through babel. This could be fixed by "(setq org-babel-python-command "python -i -c \"import sys; sys.stderr = sys.stdout\"")". Is there a similar method to re-direct the stderr of a shell script to stdout as well?