help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Summarising compiler output?


From: Danny Boelens
Subject: Re: Summarising compiler output?
Date: Tue, 03 Aug 2010 10:19:34 +0200
User-agent: Thunderbird 2.0.0.24 (Windows/20100228)

On 2/08/2010 18:08, Erik Rull wrote:

I would propose:
php -l | grep "No syntax errors" -v

This returns you everything on stdout except those lines that contain "No syntax errors" Filtering done using a shell call should be faster than a parsing and filtering done by make. (Please correct me if this does not apply!!)

I can see this go wrong, if you're simply using that as recipe in a rule. If the php command fails, you'll see the "Errors parsing ..." as expected, but what's the exit code in this case? Hint: the grep in the pipe won't find matches, and the -v option is used. This in turn makes GNU make think that the command succeeded, and it'll carry on, which is usually not what you want.

There are most likely solutions/workarounds for this (the use of PIPESTATUS in bash comes to mind), but getting this right might be tricky, depending on the environment you're working in...

At first sight, I'd say the most straightforward way to fix the original problem is using a small wrapper script and temporary files. Execute the php command saving its output, check its exit code and act accordingly.

Danny



reply via email to

[Prev in Thread] Current Thread [Next in Thread]