summaryrefslogtreecommitdiff
path: root/src/other_tools/git_operations/git_repo_remote.cpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2024-03-01 18:07:04 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2024-03-08 14:18:43 +0100
commit274ee28fb5d8d5dea123eaa9fc51fd83eeda145a (patch)
tree0a048dbcc85c9372703ec7f388699002ac88ca2c /src/other_tools/git_operations/git_repo_remote.cpp
parent2ebf355989eb92ac9967eceee0af14d39477afe0 (diff)
downloadjustbuild-274ee28fb5d8d5dea123eaa9fc51fd83eeda145a.tar.gz
SystemCommand: Transfer outfile responsibility to caller
Diffstat (limited to 'src/other_tools/git_operations/git_repo_remote.cpp')
-rw-r--r--src/other_tools/git_operations/git_repo_remote.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/other_tools/git_operations/git_repo_remote.cpp b/src/other_tools/git_operations/git_repo_remote.cpp
index f3964e74..706eedae 100644
--- a/src/other_tools/git_operations/git_repo_remote.cpp
+++ b/src/other_tools/git_operations/git_repo_remote.cpp
@@ -459,13 +459,13 @@ auto GitRepoRemote::UpdateCommitViaTmpRepo(
}
// set up the system command
SystemCommand system{repo_url};
- auto const command_output =
+ auto const exit_code =
system.Execute(cmdline,
env,
GetGitPath(), // which path is not actually relevant
tmp_path);
- if (not command_output) {
+ if (not exit_code) {
(*logger)(fmt::format("exec() on command failed."),
/*fatal=*/true);
return std::nullopt;
@@ -473,15 +473,14 @@ auto GitRepoRemote::UpdateCommitViaTmpRepo(
// output file can be read anyway
std::string out_str{};
- auto cmd_out = FileSystemManager::ReadFile(command_output->stdout_file);
+ auto cmd_out = FileSystemManager::ReadFile(tmp_path / "stdout");
if (cmd_out) {
out_str = *cmd_out;
}
// check for command failure
- if (command_output->return_value != 0) {
+ if (*exit_code != 0) {
std::string err_str{};
- auto cmd_err =
- FileSystemManager::ReadFile(command_output->stderr_file);
+ auto cmd_err = FileSystemManager::ReadFile(tmp_path / "stderr");
if (cmd_err) {
err_str = *cmd_err;
@@ -618,22 +617,20 @@ auto GitRepoRemote::FetchViaTmpRepo(std::string const& repo_url,
}
// run command
SystemCommand system{repo_url};
- auto const command_output =
+ auto const exit_code =
system.Execute(cmdline, env, GetGitPath(), tmp_path);
- if (not command_output) {
+ if (not exit_code) {
(*logger)(fmt::format("exec() on command failed."),
/*fatal=*/true);
return false;
}
- if (command_output->return_value != 0) {
+ if (*exit_code != 0) {
std::string out_str{};
std::string err_str{};
- auto cmd_out =
- FileSystemManager::ReadFile(command_output->stdout_file);
- auto cmd_err =
- FileSystemManager::ReadFile(command_output->stderr_file);
+ auto cmd_out = FileSystemManager::ReadFile(tmp_path / "stdout");
+ auto cmd_err = FileSystemManager::ReadFile(tmp_path / "stderr");
if (cmd_out) {
out_str = *cmd_out;
}