diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2023-03-27 17:31:51 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2023-04-11 10:18:16 +0100 |
commit | b9aa10efcb03c08a4a655ea2b5559bb069de3fb1 (patch) | |
tree | fdffd9f1ab006a58a0208e160887954b75baf721 /src/util/unix | |
parent | 8b6d910d330394f2480e3e17dd3eb58685c78768 (diff) | |
download | libgit2-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.c | 13 |
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; |