summaryrefslogtreecommitdiff
path: root/src/util/unix
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-03-27 17:31:51 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-04-11 10:18:16 +0100
commitb9aa10efcb03c08a4a655ea2b5559bb069de3fb1 (patch)
treefdffd9f1ab006a58a0208e160887954b75baf721 /src/util/unix
parent8b6d910d330394f2480e3e17dd3eb58685c78768 (diff)
downloadlibgit2-b9aa10efcb03c08a4a655ea2b5559bb069de3fb1.tar.gz
process: test SIGTERM detection
We can't reliably detect SIGPIPE on close because of platform differences. Track `pid` and send `SIGTERM` to a function and ensure that we can detect it.
Diffstat (limited to 'src/util/unix')
-rw-r--r--src/util/unix/process.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/unix/process.c b/src/util/unix/process.c
index b5e259977..ce28705a9 100644
--- a/src/util/unix/process.c
+++ b/src/util/unix/process.c
@@ -422,6 +422,19 @@ on_error:
return -1;
}
+int git_process_id(p_pid_t *out, git_process *process)
+{
+ GIT_ASSERT(out && process);
+
+ if (!process->pid) {
+ git_error_set(GIT_ERROR_INVALID, "process not running");
+ return -1;
+ }
+
+ *out = process->pid;
+ return 0;
+}
+
ssize_t git_process_read(git_process *process, void *buf, size_t count)
{
ssize_t ret;