X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fwin32.c;h=49ba63ae93bcaf587ae2d0fe7aeece5433ebd5cb;hb=802134916c56985ba8dc700565240474646eb9f7;hp=240aa6284d7ec38a1867095d2c4ca6f41eb5174a;hpb=db2fab4887d7a0167a72ea9848aab50a7132bbbb;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/win32.c b/win32/win32.c index 240aa62..49ba63a 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1793,6 +1793,8 @@ win32_async_check(pTHX) * is generating messages before the process terminated. */ PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE|PM_NOYIELD); + if (PL_sig_pending) + despatch_signals(); return 1; } @@ -2724,16 +2726,16 @@ win32_popen(const char *command, const char *mode) if (win32_pipe(p, 512, ourmode) == -1) return NULL; - /* save current stdfd */ - if ((oldfd = win32_dup(stdfd)) == -1) - goto cleanup; - /* save the old std handle (this needs to happen before the * dup2(), since that might call SetStdHandle() too) */ OP_REFCNT_LOCK; lock_held = 1; old_h = GetStdHandle(nhandle); + /* save current stdfd */ + if ((oldfd = win32_dup(stdfd)) == -1) + goto cleanup; + /* make stdfd go to child end of pipe (implicitly closes stdfd) */ /* stdfd will be inherited by the child */ if (win32_dup2(p[child], stdfd) == -1) @@ -2755,6 +2757,9 @@ win32_popen(const char *command, const char *mode) if (win32_dup2(oldfd, stdfd) == -1) goto cleanup; + /* close saved handle */ + win32_close(oldfd); + /* restore the old std handle (this needs to happen after the * dup2(), since that might call SetStdHandle() too */ if (lock_held) { @@ -2763,9 +2768,6 @@ win32_popen(const char *command, const char *mode) lock_held = 0; } - /* close saved handle */ - win32_close(oldfd); - LOCK_FDPID_MUTEX; sv_setiv(*av_fetch(w32_fdpid, p[parent], TRUE), childpid); UNLOCK_FDPID_MUTEX; @@ -2781,15 +2783,15 @@ cleanup: /* we don't need to check for errors here */ win32_close(p[0]); win32_close(p[1]); + if (oldfd != -1) { + win32_dup2(oldfd, stdfd); + win32_close(oldfd); + } if (lock_held) { SetStdHandle(nhandle, old_h); OP_REFCNT_UNLOCK; lock_held = 0; } - if (oldfd != -1) { - win32_dup2(oldfd, stdfd); - win32_close(oldfd); - } return (NULL); #endif /* USE_RTL_POPEN */ @@ -4872,6 +4874,7 @@ Perl_win32_init(int *argcp, char ***argvp) void Perl_win32_term(void) { + HINTS_REFCNT_TERM; OP_REFCNT_TERM; MALLOC_TERM; }