Re: [O] diff in `src' blocks

2013-05-14 Thread Michael Brand
> http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=45881

Sorry, the above was with the wrong message focus. Corrected:
http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=46415



Re: [O] diff in `src' blocks

2013-05-14 Thread Michael Brand
Hi all

On Mon, May 13, 2013 at 7:59 PM, Achim Gratz  wrote:
> All things considered, there may be room for an argument that Babel
> shouldn't ignore the data from STDOUT on non-zero exit [...]

Yes please, and a report of the actual exit status in the babel result
would be nice, probably as an option in the source block header. In
addition babel should also not ignore stderr on exit status 0, see my
example 2) with GNU/Linux's strace in a lengthy post about my thoughts
and workarounds for stdout, stderr and exit status with babel. It
contains a complete set of the different cases as I see them:
http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=45881

Michael



Re: [O] diff in `src' blocks

2013-05-13 Thread Samuel Wales
On 5/13/13, Achim Gratz  wrote:
> All things considered, there may be room for an argument that Babel
> shouldn't ignore the data from STDOUT on non-zero exit or have an option
> to ignore the return code for cases like this.

That sounds good for newcomers.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.



Re: [O] diff in `src' blocks

2013-05-13 Thread Achim Gratz
Achim Gratz writes:
>> Is this this a bug?
>
> I don't think so, although Babel could give a more enlightening message
> about why it didn't evaluate STDOUT.  It gives this on your original example:
>
> Babel evaluation exited with code 1
> Code block produced no output.

All things considered, there may be room for an argument that Babel
shouldn't ignore the data from STDOUT on non-zero exit or have an option
to ignore the return code for cases like this.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




Re: [O] diff in `src' blocks

2013-05-13 Thread Oliver Večerník
>> Figured out myself, sorry for the noise.  It has to do with the exit
>> status of the `diff', which is 1 if the files are different.  So I use
>> the pipe through `cat'.
>
> Useless use of cat...

At least the return status is zero.  But I agree with you, a colon is
better here.  This is my first use of a `:' btw.  I never had case
before.

-- 
Thanks,
Oliver




Re: [O] diff in `src' blocks

2013-05-13 Thread Achim Gratz
Oliver Večerník  vecernik.at> writes:
> Figured out myself, sorry for the noise.  It has to do with the exit
> status of the `diff', which is 1 if the files are different.  So I use
> the pipe through `cat'.

Useless use of cat...


Regards,
Achim





Re: [O] diff in `src' blocks

2013-05-13 Thread Achim Gratz
Oliver Večerník  vecernik.at> writes:
> Why is the `diff' command alone not exported while the piped `diff' via
> `cat' works?

The exit code is not zero since diff found differences, so Babel assumes the
script produced an error.  Try this instead when you don't know what the
return code of the last command will be or if you know that it isn't zero
even when no error occured:

#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt
:
#+END_SRC

> Is this this a bug?

I don't think so, although Babel could give a more enlightening message
about why it didn't evaluate STDOUT.  It gives this on your original example:

Babel evaluation exited with code 1
Code block produced no output.



Regards,
Achim.





Re: [O] diff in `src' blocks

2013-05-13 Thread Oliver Večerník
> Why is the `diff' command alone not exported while the piped `diff' via
> `cat' works?  Is this this a bug?

Figured out myself, sorry for the noise.  It has to do with the exit
status of the `diff', which is 1 if the files are different.  So I use
the pipe through `cat'.




[O] diff in `src' blocks

2013-05-13 Thread Oliver Večerník
Hi,

in the following org file the second block gets not exported (tested with
text and html exporter, release_8.0.2-119-g646f1a):

--8<---cut here---start->8---
#+OPTIONS: toc:nil author:nil

#+BEGIN_SRC sh :exports results :results output
cat testdiff.txt.orig
#+END_SRC

#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt
#+END_SRC

#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt | cat
#+END_SRC

#+BEGIN_SRC sh :exports results :results output
ls testdiff.*
#+END_SRC
--8<---cut here---end--->8---

   __

TESTDIFF
   __


,
| asdf
| ghjk
`

,
| 1c1
| < asdf
| ---
| > qwer
`

,
| testdiff.html
| testdiff.org
| testdiff.txt
| testdiff.txt.orig
`

Why is the `diff' command alone not exported while the piped `diff' via
`cat' works?  Is this this a bug?

-- 
Regards,
Oliver