mirror of
https://github.com/reactos/CMake.git
synced 2025-01-08 12:10:29 +00:00
cmSystemTools: Stdout(),Stderr() accept std::string argument
This commit is contained in:
parent
c902e775ec
commit
3132ea801c
@ -2781,13 +2781,13 @@ bool cmCTest::RunCommand(std::vector<std::string> const& args,
|
||||
if ((res == cmsysProcess_Pipe_STDOUT || res == cmsysProcess_Pipe_STDERR) &&
|
||||
this->ExtraVerbose) {
|
||||
processOutput.DecodeText(data, length, strdata);
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
}
|
||||
if (this->ExtraVerbose) {
|
||||
processOutput.DecodeText(std::string(), strdata);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ void cmDepends::Clear(const char* file)
|
||||
if (this->Verbose) {
|
||||
std::ostringstream msg;
|
||||
msg << "Clearing dependencies in \"" << file << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
|
||||
// Write an empty dependency file.
|
||||
@ -170,7 +170,7 @@ bool cmDepends::CheckDependencies(
|
||||
std::ostringstream msg;
|
||||
msg << "Dependee \"" << dependee << "\" does not exist for depender \""
|
||||
<< depender << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
} else {
|
||||
if (dependerExists) {
|
||||
@ -187,7 +187,7 @@ bool cmDepends::CheckDependencies(
|
||||
std::ostringstream msg;
|
||||
msg << "Dependee \"" << dependee << "\" is newer than depender \""
|
||||
<< depender << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -206,7 +206,7 @@ bool cmDepends::CheckDependencies(
|
||||
msg << "Dependee \"" << dependee
|
||||
<< "\" is newer than depends file \""
|
||||
<< internalDependsFileName << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
|
||||
if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) {
|
||||
if (verbose) {
|
||||
processOutput.DecodeText(data, length, strdata);
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
output.append(data, length);
|
||||
}
|
||||
@ -230,7 +230,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
|
||||
if (verbose) {
|
||||
processOutput.DecodeText(std::string(), strdata);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
|
||||
}
|
||||
msg += "\n";
|
||||
if (verbose) {
|
||||
cmSystemTools::Stdout(msg.c_str());
|
||||
cmSystemTools::Stdout(msg);
|
||||
}
|
||||
output += msg;
|
||||
#else
|
||||
|
@ -249,14 +249,14 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
|
||||
if (p == cmsysProcess_Pipe_STDOUT && !output_quiet) {
|
||||
if (output_variable.empty()) {
|
||||
processOutput.DecodeText(data, length, strdata, 1);
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
} else {
|
||||
cmExecuteProcessCommandAppend(tempOutput, data, length);
|
||||
}
|
||||
} else if (p == cmsysProcess_Pipe_STDERR && !error_quiet) {
|
||||
if (error_variable.empty()) {
|
||||
processOutput.DecodeText(data, length, strdata, 2);
|
||||
cmSystemTools::Stderr(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stderr(strdata);
|
||||
} else {
|
||||
cmExecuteProcessCommandAppend(tempError, data, length);
|
||||
}
|
||||
@ -265,13 +265,13 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
|
||||
if (!output_quiet && output_variable.empty()) {
|
||||
processOutput.DecodeText(std::string(), strdata, 1);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
}
|
||||
if (!error_quiet && error_variable.empty()) {
|
||||
processOutput.DecodeText(std::string(), strdata, 2);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stderr(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stderr(strdata);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
||||
std::ostringstream msg;
|
||||
msg << "Dependee \"" << tgtInfo << "\" is newer than depender \""
|
||||
<< internalDependFile << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
needRescanDependInfo = true;
|
||||
}
|
||||
@ -1307,7 +1307,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
|
||||
std::ostringstream msg;
|
||||
msg << "Dependee \"" << dirInfoFile << "\" is newer than depender \""
|
||||
<< internalDependFile << "\"." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
needRescanDirInfo = true;
|
||||
}
|
||||
@ -1489,7 +1489,7 @@ void cmLocalUnixMakefileGenerator3::CheckMultipleOutputs(bool verbose)
|
||||
msg << "Deleting primary custom command output \"" << dependee
|
||||
<< "\" because another output \"" << depender
|
||||
<< "\" does not exist." << std::endl;
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
cmSystemTools::RemoveFile(dependee);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ void cmQtAutoGenerator::Logger::Info(GeneratorT genType,
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Mutex_);
|
||||
cmSystemTools::Stdout(msg.c_str(), msg.size());
|
||||
cmSystemTools::Stdout(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ void cmQtAutoGenerator::Logger::Warning(GeneratorT genType,
|
||||
msg.push_back('\n');
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Mutex_);
|
||||
cmSystemTools::Stdout(msg.c_str(), msg.size());
|
||||
cmSystemTools::Stdout(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ void cmQtAutoGenerator::Logger::Error(GeneratorT genType,
|
||||
msg.push_back('\n');
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Mutex_);
|
||||
cmSystemTools::Stderr(msg.c_str(), msg.size());
|
||||
cmSystemTools::Stderr(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ void cmQtAutoGenerator::Logger::ErrorCommand(
|
||||
msg.push_back('\n');
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(Mutex_);
|
||||
cmSystemTools::Stderr(msg.c_str(), msg.size());
|
||||
cmSystemTools::Stderr(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,33 +302,21 @@ void cmSystemTools::SetStderrCallback(OutputCallback f, void* clientData)
|
||||
s_StderrCallbackClientData = clientData;
|
||||
}
|
||||
|
||||
void cmSystemTools::Stdout(const char* s)
|
||||
{
|
||||
cmSystemTools::Stdout(s, strlen(s));
|
||||
}
|
||||
|
||||
void cmSystemTools::Stderr(const char* s)
|
||||
{
|
||||
cmSystemTools::Stderr(s, strlen(s));
|
||||
}
|
||||
|
||||
void cmSystemTools::Stderr(const char* s, size_t length)
|
||||
void cmSystemTools::Stderr(const std::string& s)
|
||||
{
|
||||
if (s_StderrCallback) {
|
||||
(*s_StderrCallback)(s, length, s_StderrCallbackClientData);
|
||||
(*s_StderrCallback)(s.c_str(), s.length(), s_StderrCallbackClientData);
|
||||
} else {
|
||||
std::cerr.write(s, length);
|
||||
std::cerr.flush();
|
||||
std::cerr << s << std::flush;
|
||||
}
|
||||
}
|
||||
|
||||
void cmSystemTools::Stdout(const char* s, size_t length)
|
||||
void cmSystemTools::Stdout(const std::string& s)
|
||||
{
|
||||
if (s_StdoutCallback) {
|
||||
(*s_StdoutCallback)(s, length, s_StdoutCallbackClientData);
|
||||
(*s_StdoutCallback)(s.c_str(), s.length(), s_StdoutCallbackClientData);
|
||||
} else {
|
||||
std::cout.write(s, length);
|
||||
std::cout.flush();
|
||||
std::cout << s << std::flush;
|
||||
}
|
||||
}
|
||||
|
||||
@ -792,7 +780,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
|
||||
if (pipe == cmsysProcess_Pipe_STDOUT) {
|
||||
if (outputflag != OUTPUT_NONE) {
|
||||
processOutput.DecodeText(data, length, strdata, 1);
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
if (captureStdOut) {
|
||||
tempStdOut.insert(tempStdOut.end(), data, data + length);
|
||||
@ -800,7 +788,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
|
||||
} else if (pipe == cmsysProcess_Pipe_STDERR) {
|
||||
if (outputflag != OUTPUT_NONE) {
|
||||
processOutput.DecodeText(data, length, strdata, 2);
|
||||
cmSystemTools::Stderr(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stderr(strdata);
|
||||
}
|
||||
if (captureStdErr) {
|
||||
tempStdErr.insert(tempStdErr.end(), data, data + length);
|
||||
@ -811,11 +799,11 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
|
||||
if (outputflag != OUTPUT_NONE) {
|
||||
processOutput.DecodeText(std::string(), strdata, 1);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stdout(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stdout(strdata);
|
||||
}
|
||||
processOutput.DecodeText(std::string(), strdata, 2);
|
||||
if (!strdata.empty()) {
|
||||
cmSystemTools::Stderr(strdata.c_str(), strdata.size());
|
||||
cmSystemTools::Stderr(strdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1899,13 +1887,13 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
|
||||
if (verbose) {
|
||||
if (extract) {
|
||||
cmSystemTools::Stdout("x ");
|
||||
cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str());
|
||||
cmSystemTools::Stdout(cm_archive_entry_pathname(entry));
|
||||
} else {
|
||||
list_item_verbose(stdout, entry);
|
||||
}
|
||||
cmSystemTools::Stdout("\n");
|
||||
} else if (!extract) {
|
||||
cmSystemTools::Stdout(cm_archive_entry_pathname(entry).c_str());
|
||||
cmSystemTools::Stdout(cm_archive_entry_pathname(entry));
|
||||
cmSystemTools::Stdout("\n");
|
||||
}
|
||||
if (extract) {
|
||||
|
@ -79,13 +79,11 @@ public:
|
||||
typedef void (*OutputCallback)(const char*, size_t length, void*);
|
||||
|
||||
///! Send a string to stdout
|
||||
static void Stdout(const char* s);
|
||||
static void Stdout(const char* s, size_t length);
|
||||
static void Stdout(const std::string& s);
|
||||
static void SetStdoutCallback(OutputCallback, void* clientData = nullptr);
|
||||
|
||||
///! Send a string to stderr
|
||||
static void Stderr(const char* s);
|
||||
static void Stderr(const char* s, size_t length);
|
||||
static void Stderr(const std::string& s);
|
||||
static void SetStderrCallback(OutputCallback, void* clientData = nullptr);
|
||||
|
||||
typedef bool (*InterruptCallback)(void*);
|
||||
|
@ -2006,7 +2006,7 @@ int cmake::CheckBuildSystem()
|
||||
if (verbose) {
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake no build system arguments\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2017,7 +2017,7 @@ int cmake::CheckBuildSystem()
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake missing file: " << this->CheckBuildSystemArgument
|
||||
<< "\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2037,7 +2037,7 @@ int cmake::CheckBuildSystem()
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake error reading : " << this->CheckBuildSystemArgument
|
||||
<< "\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
// There was an error reading the file. Just rerun.
|
||||
return 1;
|
||||
@ -2071,7 +2071,7 @@ int cmake::CheckBuildSystem()
|
||||
if (verbose) {
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake, missing byproduct: " << p << "\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2092,7 +2092,7 @@ int cmake::CheckBuildSystem()
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake no CMAKE_MAKEFILE_DEPENDS "
|
||||
"or CMAKE_MAKEFILE_OUTPUTS :\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2111,7 +2111,7 @@ int cmake::CheckBuildSystem()
|
||||
if (verbose) {
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake: build system dependency is missing\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2131,7 +2131,7 @@ int cmake::CheckBuildSystem()
|
||||
if (verbose) {
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake: build system output is missing\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -2147,7 +2147,7 @@ int cmake::CheckBuildSystem()
|
||||
std::ostringstream msg;
|
||||
msg << "Re-run cmake file: " << out_oldest
|
||||
<< " older than: " << dep_newest << "\n";
|
||||
cmSystemTools::Stdout(msg.str().c_str());
|
||||
cmSystemTools::Stdout(msg.str());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user