summaryrefslogtreecommitdiffstats
path: root/Source/cmExecProgramCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmExecProgramCommand.cxx')
-rw-r--r--Source/cmExecProgramCommand.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx
index a3d6852..6a7292d 100644
--- a/Source/cmExecProgramCommand.cxx
+++ b/Source/cmExecProgramCommand.cxx
@@ -2,9 +2,14 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmExecProgramCommand.h"
+#include <cmsys/Process.h>
+#include <stdio.h>
+
+#include "cmMakefile.h"
+#include "cmProcessOutput.h"
#include "cmSystemTools.h"
-#include <cmsys/Process.h>
+class cmExecutionStatus;
// cmExecProgramCommand
bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
@@ -112,7 +117,7 @@ bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args,
bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
int& retVal, const char* dir,
- bool verbose)
+ bool verbose, Encoding encoding)
{
if (cmSystemTools::GetRunCommandOutput()) {
verbose = false;
@@ -210,17 +215,28 @@ bool cmExecProgramCommand::RunCommand(const char* command, std::string& output,
int length;
char* data;
int p;
+ cmProcessOutput processOutput(encoding);
+ std::string strdata;
while ((p = cmsysProcess_WaitForData(cp, &data, &length, CM_NULLPTR), p)) {
if (p == cmsysProcess_Pipe_STDOUT || p == cmsysProcess_Pipe_STDERR) {
if (verbose) {
- cmSystemTools::Stdout(data, length);
+ processOutput.DecodeText(data, length, strdata);
+ cmSystemTools::Stdout(strdata.c_str(), strdata.size());
}
output.append(data, length);
}
}
+ if (verbose) {
+ processOutput.DecodeText(std::string(), strdata);
+ if (!strdata.empty()) {
+ cmSystemTools::Stdout(strdata.c_str(), strdata.size());
+ }
+ }
+
// All output has been read. Wait for the process to exit.
cmsysProcess_WaitForExit(cp, CM_NULLPTR);
+ processOutput.DecodeText(output, output);
// Check the result of running the process.
std::string msg;