summaryrefslogtreecommitdiff
path: root/src/w32proc.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2017-08-29 21:53:49 +0300
committerEli Zaretskii <eliz@gnu.org>2017-08-29 21:53:49 +0300
commit02255c5fbc7e6dc0206db978994617cc72de4bb8 (patch)
treebecbe4e32051d0abe8188ef16f5d5bf110ef0861 /src/w32proc.c
parent1454ad6f068f1d94070943b6784bc127a3119055 (diff)
downloademacs-02255c5fbc7e6dc0206db978994617cc72de4bb8.tar.gz
Avoid spinning waiting for git-gui.exe on Windows
* src/w32proc.c (waitpid): If GetExitCodeProcess returns STILL_ACTIVE, and we were called with WNOHANG, pretend that the process exited. (Bug#28268)
Diffstat (limited to 'src/w32proc.c')
-rw-r--r--src/w32proc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/w32proc.c b/src/w32proc.c
index ffd5f0d0a1a..71bd28d3c24 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1492,12 +1492,17 @@ waitpid (pid_t pid, int *status, int options)
}
if (retval == STILL_ACTIVE)
{
- /* Should never happen. */
+ /* Should never happen. But it does, with invoking git-gui.exe
+ asynchronously. So we punt, and just report this process as
+ exited with exit code 259, when we are called with WNOHANG
+ from child_status_changed, because in that case we already
+ _know_ the process has died. */
DebPrint (("Wait.WaitForMultipleObjects returned an active process\n"));
- if (pid > 0 && dont_wait)
- return 0;
- errno = EINVAL;
- return -1;
+ if (!(pid > 0 && dont_wait))
+ {
+ errno = EINVAL;
+ return -1;
+ }
}
/* Massage the exit code from the process to match the format expected