That looks pretty good. Since it does not add any new quotes, I can run a 
simple regex through all Tupfiles and match all one-line rules with pipes 
and add pipefail in front of a corresponding commands.

Thank you!
Konstantin.

PS. I think it would be great if Tup had some kind of option/variable to 
enable pipefail behavior globally, so it would be no need to modify 
individual build rules.


On Saturday, May 2, 2015 at 1:29:47 PM UTC-7, Ryan Gonzalez wrote:
>
> 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] <javascript:>> 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] <javascript:>
>> unsubscribe: [email protected] <javascript:>
>> 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] <javascript:>.
>> 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