#include "Util.hpp"
+#include <Logging.hpp>
#include <core/exceptions.hpp>
#include <util/file.hpp>
#include <util/string.hpp>
{
const auto argtext = util::read_file<std::string>(filename);
if (!argtext) {
+ LOG("Failed to read atfile {}: {}", filename, argtext.error());
return std::nullopt;
}
const std::string& output_dep = ctx.args_info.output_dep;
const auto file_content = util::read_file<std::string>(output_dep);
if (!file_content) {
- LOG("Cannot open dependency file {}: {}", output_dep, file_content.error());
+ LOG("Failed to read dependency file {}: {}",
+ output_dep,
+ file_content.error());
return;
}
const auto new_content = rewrite_source_paths(ctx, *file_content);
{
auto data = util::read_file<std::string>(path);
if (!data) {
- LOG("Failed reading {}: {}", path, data.error());
+ LOG("Failed to read {}: {}", path, data.error());
return nonstd::make_unexpected(Statistic::internal_error);
}
const auto file_content =
util::read_file<std::string>(ctx.args_info.output_dep);
if (!file_content) {
- LOG("Cannot open dependency file {}: {}",
+ LOG("Failed to read dependency file {}: {}",
ctx.args_info.output_dep,
file_content.error());
return std::nullopt;
if (capture_stdout) {
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.
+ LOG("Failed to read {} (cleanup in progress?): {}",
+ tmp_stdout.path,
+ stdout_data_result.error());
return nonstd::make_unexpected(Statistic::missing_cache_file);
}
stdout_data = *stdout_data_result;
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.
+ LOG("Failed to read {} (cleanup in progress?): {}",
+ tmp_stderr.path,
+ stderr_data_result.error());
return nonstd::make_unexpected(Statistic::missing_cache_file);
}
const auto result = util::read_file<std::vector<uint8_t>>(path);
if (!result) {
return nonstd::make_unexpected(
- FMT("Failed to read from {}: {}", path, result.error()));
+ FMT("Failed to read {}: {}", path, result.error()));
}
return *result;
}
const auto data = util::read_file<std::string>(path, size_hint);
if (!data) {
+ LOG("Failed to read {}: {}", path, data.error());
return HASH_SOURCE_CODE_ERROR;
}
const auto data = util::read_file<std::string>(m_path);
if (!data) {
- // Ignore.
+ // A nonexistent stats file is OK.
return counters;
}
}
int saved_errno = errno;
- LOG("Could not acquire {}: {}", m_lock_file, strerror(saved_errno));
if (saved_errno == ENOENT) {
// Directory doesn't exist?
if (Util::create_dir(Util::dir_name(m_lock_file))) {
continue;
}
}
+ LOG("Could not acquire {}: {}", m_lock_file, strerror(saved_errno));
if (saved_errno == EPERM) {
// The file system does not support symbolic links. We have no choice but
if (size_hint == 0) {
const auto stat = Stat::stat(path);
if (!stat) {
- LOG("Failed to stat {}: {}", path, strerror(errno));
return nonstd::make_unexpected(strerror(errno));
}
size_hint = stat.size();
}();
Fd fd(open(path.c_str(), open_flags));
if (!fd) {
- LOG("Failed to open {}: {}", path, strerror(errno));
return nonstd::make_unexpected(strerror(errno));
}
}
if (ret == -1) {
- LOG("Failed to read {}: {}", path, strerror(errno));
return nonstd::make_unexpected(strerror(errno));
}