Skip to content

Ninja hides the exit status of failing subprocesses #1507

@jonesmz

Description

@jonesmz

In build.cc, Ninja checks if the subprocess succeeded or failed

  // Print the command that is spewing before printing its output.
  if (!success) {
    string outputs;
    for (vector<Node*>::const_iterator o = edge->outputs_.begin();
         o != edge->outputs_.end(); ++o)
      outputs += (*o)->path() + " ";

    printer_.PrintOnNewLine("FAILED: " + outputs + "\n");
    printer_.PrintOnNewLine(edge->EvaluateCommand() + "\n");
  }

But by this point in the build, Ninja has already discarded the actual exit value from the subprocess.

There are a variety of tools that don't print anything to the console when they fail to run, relying on the user to instead check the exit status to see what the reason for failure was.

This is especially problematic for third party tools where the source code is not available.

It's, of course, possible to get the exit status printed to the console using a wrapper script, but as discussed at extreme length, wrapper scripts are desired by basically no one.

Ninja should print the exit status of failing subprocesses.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions