Ninja: print error message when command failed
This commit is contained in:
parent
5f12424ebc
commit
24a35cef25
|
@ -178,11 +178,9 @@ static int process( const std::string& srcfilename,
|
||||||
bool quiet = false)
|
bool quiet = false)
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
int ret = 0;
|
|
||||||
// break up command line into a vector
|
// break up command line into a vector
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
cmSystemTools::ParseWindowsCommandLine(cmd.c_str(),
|
cmSystemTools::ParseWindowsCommandLine(cmd.c_str(), args);
|
||||||
args);
|
|
||||||
// convert to correct vector type for RunSingleCommand
|
// convert to correct vector type for RunSingleCommand
|
||||||
std::vector<cmStdString> command;
|
std::vector<cmStdString> command;
|
||||||
for(std::vector<std::string>::iterator i = args.begin();
|
for(std::vector<std::string>::iterator i = args.begin();
|
||||||
|
@ -191,14 +189,10 @@ static int process( const std::string& srcfilename,
|
||||||
command.push_back(i->c_str());
|
command.push_back(i->c_str());
|
||||||
}
|
}
|
||||||
// run the command
|
// run the command
|
||||||
bool success =
|
int exit_code = 0;
|
||||||
cmSystemTools::RunSingleCommand(command, &output, &ret, dir.c_str(),
|
bool run = cmSystemTools::RunSingleCommand(command, &output, &exit_code,
|
||||||
cmSystemTools::OUTPUT_NONE);
|
dir.c_str(), cmSystemTools::OUTPUT_NONE);
|
||||||
if(ret!= 0)
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
int exit_code = ret;
|
|
||||||
// process the include directives and output everything else
|
// process the include directives and output everything else
|
||||||
std::stringstream ss(output);
|
std::stringstream ss(output);
|
||||||
std::string line;
|
std::string line;
|
||||||
|
@ -221,14 +215,11 @@ static int process( const std::string& srcfilename,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
return exit_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't update .d until/unless we succeed compilation
|
// don't update .d until/unless we succeed compilation
|
||||||
|
if (run && exit_code == 0)
|
||||||
outputDepFile(dfile, objfile, includes);
|
outputDepFile(dfile, objfile, includes);
|
||||||
|
|
||||||
return 0;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue