aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-06-23 15:10:31 +0200
committereldritch horrors <pennae@lix.systems>2024-06-23 17:29:40 +0000
commit2bbdaf0b19066ea1764e8d5810c2b250dbf0a850 (patch)
tree310307b5bdc0b80103b5ae6e180303c9753cb9bb /src/libfetchers
parent2fe9157808ab26e7ca5ac2b7e800c44067d1ef8e (diff)
libfetchers: write git commit message to tempfile
we want to remove runProgram's ability to provide stdin to a process because the concurrency issues of handling both stdin and stdout are much more pronounced once runProgram returns not is collected output but a source. this is possible in the current c++ framework, however it isn't necessary in almost all cases (as demonstrated by only this single user existing) and in much better handled with a proper async concurrency model that lets the caller handle both at the same time. Change-Id: I29da1e1ad898d45e2e33a7320b246d5003e7712b
Diffstat (limited to 'src/libfetchers')
-rw-r--r--src/libfetchers/git.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc
index 0cb826075..f2d577914 100644
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -396,12 +396,15 @@ struct GitInputScheme : InputScheme
if (commitMsg) {
+ auto [_fd, msgPath] = createTempFile("nix-msg");
+ AutoDelete const _delete{msgPath};
+ writeFile(msgPath, *commitMsg);
+
// Pause the logger to allow for user input (such as a gpg passphrase) in `git commit`
logger->pause();
Finally restoreLogger([]() { logger->resume(); });
runProgram("git", true,
- { "-C", *root, "--git-dir", gitDir, "commit", std::string(path.rel()), "-F", "-" },
- *commitMsg);
+ { "-C", *root, "--git-dir", gitDir, "commit", std::string(path.rel()), "-F", msgPath });
}
}
}