From: Erik Faye-Lund Date: Thu, 4 Nov 2010 01:35:14 +0000 (+0100) Subject: mingw: support waitpid with pid > 0 and WNOHANG X-Git-Tag: v1.7.4-rc0~125^2~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ef7108caf3cd200620000921f1b121f8c78d9d3b;p=git.git mingw: support waitpid with pid > 0 and WNOHANG Signed-off-by: Erik Faye-Lund Signed-off-by: Junio C Hamano --- diff --git a/compat/mingw.c b/compat/mingw.c index 736d03fa0..47a0e8861 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1554,6 +1554,14 @@ pid_t waitpid(pid_t pid, int *status, unsigned options) return -1; } + if (pid > 0 && options & WNOHANG) { + if (WAIT_OBJECT_0 != WaitForSingleObject(h, 0)) { + CloseHandle(h); + return 0; + } + options &= ~WNOHANG; + } + if (options == 0) { struct pinfo_t **ppinfo; if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) { diff --git a/compat/mingw.h b/compat/mingw.h index 7c4eeea38..379d7bff2 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -140,6 +140,7 @@ static inline int mingw_unlink(const char *pathname) } #define unlink mingw_unlink +#define WNOHANG 1 pid_t waitpid(pid_t pid, int *status, unsigned options); #ifndef NO_OPENSSL