}
void
-Context::register_pending_tmp_file(const std::string& path)
+Context::register_pending_tmp_file(const fs::path& path)
{
SignalHandlerBlocker signal_handler_blocker;
++it) {
// Don't call util::remove or std::filesystem::remove since they are not
// signal safe.
- unlink(it->c_str());
+ unlink(util::pstr(*it).c_str());
}
// Don't clear m_pending_tmp_files since this method must be signal safe.
}
bool auto_depend_mode = false;
// Register a temporary file to remove at program exit.
- void register_pending_tmp_file(const std::string& path);
+ void register_pending_tmp_file(const std::filesystem::path& path);
private:
// Options to ignore for the hash.
// [Start of variables touched by the signal handler]
// Temporary files to remove at program exit.
- std::vector<std::string> m_pending_tmp_files;
+ std::vector<std::filesystem::path> m_pending_tmp_files;
// [End of variables touched by the signal handler]
auto tmp_stdout =
util::value_or_throw<core::Fatal>(util::TemporaryFile::create(
FMT("{}/{}", ctx.config.temporary_dir(), description)));
- ctx.register_pending_tmp_file(util::pstr(tmp_stdout.path));
+ ctx.register_pending_tmp_file(tmp_stdout.path);
return {std::move(tmp_stdout.fd), std::move(tmp_stdout.path)};
} else {
const auto dev_null_path = util::get_dev_null_path();