help-make
[Top][All Lists]
Advanced

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

Re: suppressing shell error output


From: Martin Sebor
Subject: Re: suppressing shell error output
Date: Tue, 13 Sep 2005 16:08:14 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.10) Gecko/20050716

Paul D. Smith wrote:
%% Martin Sebor <address@hidden> writes:

  ms> Is there an efficient way to suppress the error output of the shell
  ms> in the $(shell) function?

Make can't do it.  You can only do it from within the shell script
you're invoking.

There's no way the script could do it if it doesn't exist :) Or
did you mean that I should wrap the command foo in a script that
is guaranteed to exist and invoke it instead? That would work but
it's just as inefficient as my $(shell /bin/sh) hack: it causes
two processes to be executed instead of just one.

It seems that make should provide a mechanism to do it. After all,
it lets users decide what to do with the shell error output in all
other cases.

Looking at func_shell() in function.c, the block on lines 1641-1646
looks like the output I'm trying to suppress. It should only be a
matter of coming up with suitable syntax to let callers specify what
to do with the output. Since the @ character is used to suppress
command output elsewhere, perhaps make could reuse is here as well.
How about $(@shell)?

1636 /* The child_handler function will set shell_function_completed
  1637           to 1 when the child dies normally, or to -1 if it
1638 dies with status 127, which is most likely an exec fail. */
  1639
  1640        if (shell_function_completed == -1)
  1641          {
  1642            /* This most likely means that the execvp failed,
  1643               so we should just write out the error message
  1644               that came in over the pipe from the child.  */
  1645            fputs (buffer, stderr);
  1646            fflush (stderr);
  1647          }

Martin




reply via email to

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