diff options
author | Eli Zaretskii <eliz@gnu.org> | 2012-12-10 14:08:02 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2012-12-10 14:08:02 +0200 |
commit | 3907e630a71d48e693062b350571990d7ba08bbb (patch) | |
tree | 2be1ecc0796e42c7a453a9fd5131eb5866f79876 /src/w32proc.c | |
parent | cf2d22b874ca2df0072e32ee641e8efffe4abd6d (diff) | |
parent | 81606b10501169a5671061b8461bbc32dcec8705 (diff) | |
download | emacs-3907e630a71d48e693062b350571990d7ba08bbb.tar.gz |
Merge from trunk + rename the event. Not tested yet.
Diffstat (limited to 'src/w32proc.c')
-rw-r--r-- | src/w32proc.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/src/w32proc.c b/src/w32proc.c index 2951df7ed89..ddc6826df98 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -1220,13 +1220,22 @@ waitpid (pid_t pid, int *status, int options) { QUIT; active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms); - } while (active == WAIT_TIMEOUT); + } while (active == WAIT_TIMEOUT && !dont_wait); if (active == WAIT_FAILED) { errno = EBADF; return -1; } + else if (active == WAIT_TIMEOUT && dont_wait) + { + /* PID specifies our subprocess, but it didn't exit yet, so its + status is not yet available. */ +#ifdef FULL_DEBUG + DebPrint (("Wait: PID %d not reap yet\n", cp->pid)); +#endif + return 0; + } else if (active >= WAIT_OBJECT_0 && active < WAIT_OBJECT_0+MAXIMUM_WAIT_OBJECTS) { @@ -1240,7 +1249,6 @@ waitpid (pid_t pid, int *status, int options) else emacs_abort (); -get_result: if (!GetExitCodeProcess (wait_hnd[active], &retval)) { DebPrint (("Wait.GetExitCodeProcess failed with %lu\n", @@ -1275,33 +1283,7 @@ get_result: #endif if (status) - { - *status = retval; - } - else if (synch_process_alive) - { - synch_process_alive = 0; - - /* Report the status of the synchronous process. */ - if (WIFEXITED (retval)) - synch_process_retcode = WEXITSTATUS (retval); - else if (WIFSIGNALED (retval)) - { - int code = WTERMSIG (retval); - const char *signame; - - synchronize_system_messages_locale (); - signame = strsignal (code); - - if (signame == 0) - signame = "unknown"; - - synch_process_death = signame; - } - - reap_subprocess (cp); - } - + *status = retval; reap_subprocess (cp); return pid; @@ -2157,6 +2139,10 @@ sys_kill (int pid, int sig) int need_to_free = 0; int rc = 0; + /* Each process is in its own process group. */ + if (pid < 0) + pid = -pid; + /* Only handle signals that will result in the process dying */ if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) { |