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 11:54:30 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

* John Kitchin <address@hidden> 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 stdout" >&1
echo "testing stderr" >&2
date -g
#+END_SRC

#+RESULTS:

... no stderr on stdout and date error message in second buffer


Creating a wrapper-script similar as described in web-page above:

#+BEGIN_SRC sh
echo '#!/usr/bin/zsh
{
/usr/bin/zsh $1
} 2>&1' > ~/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

#+RESULTS:

Setting the sh-command to this wrapper-script:

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

#+RESULTS:
: ~/bin/zsh_stderr_redirected_to_stdout.sh

Re-testing status:

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

#+RESULTS:

... no change except the second buffer for the date error message is
empty. So it's actually worse than before.


Trying with bash (as web-page did):

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

#+RESULTS:

Setting the sh-command to this wrapper-script:

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

#+RESULTS:
: ~/bin/bash_stderr_redirected_to_stdout.sh

Same result as with zsh :-(


Re-setting to standard settings to revoke tests from above:

#+BEGIN_SRC elisp
(setq org-babel-sh-command "sh")
#+END_SRC

#+RESULTS:
: sh

Re-testing status:

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

#+RESULTS:


-- 
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]