On 10 Mar 2010 05:30:03 -0800, David Weintraub wrote:
>
> I know that when you run a hook, the STDOUT is not returned to the
> user, and STDERR is only returned if that hook returns a non-zero exit
> code.
>
> However, I'm writing a post-commit hook, and I'd like to know if it is
> possible to pipe STDOUT to another process as part of the hook script.
> For example, in a post-commit hook, I have a Perl script that collects
> watch information, and I'd like to pipe the output of that script to
> another script that will do the actual notification. Can I do the
> following in my post-commit script:
>
> watch-file.pl | notify.pl
>
> Is that possible?

What about this basic shell manipulation?

#!/bin/sh

exec 1>&2    # combine stdout with stderr

# do stuff that generates stdout

if [ <condition> ] ; then
   exit 1       # return non-zero exit every time there's stdout
fi

Ted
-- 
 Frango ut patefaciam -- I break so that I may reveal

Reply via email to