@matheusbsbs / matheus-bagliano / commits / ef7108caf3
Fork 0

mingw: support waitpid with pid > 0 and WNOHANG

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Erik Faye-Lund committed Nov 4, 2010 at 02:35 UTC ef7108caf3cd200620000921f1b121f8c78d9d3b
2 files changed +9
compat/mingw.c
+8
@@ -1554,6 +1554,14 @@ pid_t waitpid(pid_t pid, int *status, unsigned options)
1554 return -1;
1555 }
1556
1557 + if (pid > 0 && options & WNOHANG) {
1558 + if (WAIT_OBJECT_0 != WaitForSingleObject(h, 0)) {
1559 + CloseHandle(h);
1560 + return 0;
1561 + }
1562 + options &= ~WNOHANG;
1563 + }
1564 +
1565 if (options == 0) {
1566 struct pinfo_t **ppinfo;
1567 if (WaitForSingleObject(h, INFINITE) != WAIT_OBJECT_0) {
compat/mingw.h
+1
@@ -140,6 +140,7 @@ static inline int mingw_unlink(const char *pathname)
140 }
141 #define unlink mingw_unlink
142
143 +#define WNOHANG 1
144 pid_t waitpid(pid_t pid, int *status, unsigned options);
145
146 #ifndef NO_OPENSSL