What immediately comes to mind:

: |> set -o pipefail && false | true > %o |> output.txt

Better yet:

PRE=set -o pipefail &&
: |> $(PRE) false | true > %o |> output.txt

Or one could use a macro (which, IMO, borders on weirdness).


On Sat, May 2, 2015 at 1:11 PM, <[email protected]> wrote:

> Hello!
>
> I have many build rules where multiple commands are connected via pipes.
> Tup uses exit status of the last command as a status of overall commands.
> How can I make it fail if any piped command fails? E.g. I’d like tup
> considered the following command as a failed command:
>
> : |> false | true > %o |> output.txt
>
> The following workaround does what I need:
>
> : |> ./run_cmd.sh "true | false" > %o |> output.txt
>
> where run_cmd.sh script is:
>
> #!/bin/bash
>
>
>
> set -o pipefail
>
>
>
> if [ $# -gt 0 ]; then
>
>     /bin/bash -c "$*"
>
> fi
>
>
>
> The problems with such workaround are:
>
>
>    -         My commands already contain multiple/nested quotes. Quoting
>    the whole thing would make it much less readable.
>    -         If a rule does not use the workaround then failures in piped
>    commands are silently ignored, which complicates debugging of build
>    failures.
>
>   Is there any way to make tup pay attention to the failed piped commands?
>
> Thank you,
>
> Konstantin.
>
>
>  --
> --
> tup-users mailing list
> email: [email protected]
> unsubscribe: [email protected]
> options: http://groups.google.com/group/tup-users?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "tup-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to