#10339: Simplify spkg/pipestatus
------------------------------+---------------------------------------------
Reporter: jdemeyer | Owner: GeorgSWeber
Type: defect | Status: needs_info
Priority: major | Milestone: sage-4.6.1
Component: build | Keywords: pipestatus Makefile
Author: Jeroen Demeyer | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Comment(by leif):
Replying to [comment:20 jdemeyer]:
> If you want compatibility with `pipefail`, you should exchange 0 and 1
in your patch.
No, that would return 0 if cmd1 fails but not cmd2. So we could do:
{{{
#!sh
#!/usr/bin/env bash
...
if [ ${PIPESTATUS[0]} -ne 0 ]; then
if [ ${PIPESTATUS[1]} -ne 0 ]; then
exit ${PIPESTATUS[1]}
else
exit ${PIPESTATUS[0]}
fi
fi
# else returns $?, which is ${PIPESTATUS[1]}
}}}
Ok, swapping all 0's and 1's in the previous example (but only '''with'''
the `else` part) also works.
> I would do eval "$1" | eval "$2" which I think is more logical than eval
"$1 | $2".
Is it?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10339#comment:21>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.