summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2022-10-05 21:24:14 +0300
committerGitHub <noreply@github.com>2022-10-05 20:24:14 +0200
commitf8b81c2bf89b15d0eb3fc4fee03d3be81bc06143 (patch)
tree9424b11e2a4324f4beb967f5db79628870cfc0d1
parentf3fca98dae712370b279d881594e8bc1087daf24 (diff)
downloadccache-f8b81c2bf89b15d0eb3fc4fee03d3be81bc06143.tar.gz
fix: Retain line CRLF in compiler output on Windows (#1173)
When the cached data is read, the output to fd is binary (Util::send_to_fd), so in order to maintain the original line endings, the output must be stored as binary too.
-rw-r--r--src/ccache.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ccache.cpp b/src/ccache.cpp
index 7884a009..820b58ea 100644
--- a/src/ccache.cpp
+++ b/src/ccache.cpp
@@ -732,21 +732,24 @@ do_execute(Context& ctx, Args& args, const bool capture_stdout = true)
std::string stdout_data;
if (capture_stdout) {
- auto stdout_data_result = util::read_file<std::string>(tmp_stdout.path);
+ auto stdout_data_result = util::read_file<util::Bytes>(tmp_stdout.path);
if (!stdout_data_result) {
// The stdout file was removed - cleanup in progress? Better bail out.
return nonstd::make_unexpected(Statistic::missing_cache_file);
}
- stdout_data = std::move(*stdout_data_result);
+ stdout_data = util::to_string(util::to_string_view(*stdout_data_result));
}
- auto stderr_data_result = util::read_file<std::string>(tmp_stderr.path);
+ auto stderr_data_result = util::read_file<util::Bytes>(tmp_stderr.path);
if (!stderr_data_result) {
// The stdout file was removed - cleanup in progress? Better bail out.
return nonstd::make_unexpected(Statistic::missing_cache_file);
}
- return DoExecuteResult{status, stdout_data, *stderr_data_result};
+ return DoExecuteResult{
+ status,
+ stdout_data,
+ util::to_string(util::to_string_view(*stderr_data_result))};
}
static void