help-make
[Top][All Lists]
Advanced

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

Re: ignore errors on specific command


From: Stephan Beal
Subject: Re: ignore errors on specific command
Date: Wed, 31 Mar 2010 11:16:53 +0200

On Wed, Mar 31, 2010 at 10:27 AM, Payal <address@hidden> wrote:
all:
       cmd1 ; cmd2; cmd3

How to ignore errors from cmd2 only? Putting -cmd2 will not work here.


The return value of cmd2 WILL be ignored here. cmd2 might still generate error messages but it will not cause make to fail because make is only interested in the last return code of each shell command (in this case, that of cmd3).

That said, you can explicitly force the return code to be 0 with:

all:
    cmd1 ; cmd2 || true ; cmd3

but that won't, in this case, have any effect on the make execution.

Likewise:

all:
   cmd1
   cmd2 || true
   cmd3

would fail if either cmd1 or cmd3 failed, but will ignore a failure for cmd2.


--
----- stephan beal
http://wanderinghorse.net/home/stephan/

reply via email to

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