An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit e80ca370 authored by Brad King's avatar Brad King
Browse files

ENH: Enabling process tree killing on Cygwin.

parent 28d17e64
...@@ -1909,12 +1909,15 @@ static pid_t kwsysProcessFork(kwsysProcess* cp, ...@@ -1909,12 +1909,15 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
#elif defined(__hpux) || defined(__sparc) || defined(__sgi) || defined(_AIX) #elif defined(__hpux) || defined(__sparc) || defined(__sgi) || defined(_AIX)
# define KWSYSPE_PS_COMMAND "ps -ef" # define KWSYSPE_PS_COMMAND "ps -ef"
# define KWSYSPE_PS_FORMAT "%*s %d %d %*[^\n]\n" # define KWSYSPE_PS_FORMAT "%*s %d %d %*[^\n]\n"
#elif defined(__CYGWIN__)
# define KWSYSPE_PS_COMMAND "ps aux"
# define KWSYSPE_PS_FORMAT "%d %d %*[^\n]\n"
#endif #endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
static void kwsysProcessKill(pid_t process_id) static void kwsysProcessKill(pid_t process_id)
{ {
#if defined(__linux__) #if defined(__linux__) || defined(__CYGWIN__)
DIR* procdir; DIR* procdir;
#endif #endif
...@@ -1922,7 +1925,7 @@ static void kwsysProcessKill(pid_t process_id) ...@@ -1922,7 +1925,7 @@ static void kwsysProcessKill(pid_t process_id)
kill(process_id, SIGSTOP); kill(process_id, SIGSTOP);
/* Kill all children if we can find them. */ /* Kill all children if we can find them. */
#if defined(__linux__) #if defined(__linux__) || defined(__CYGWIN__)
/* First try using the /proc filesystem. */ /* First try using the /proc filesystem. */
if((procdir = opendir("/proc")) != NULL) if((procdir = opendir("/proc")) != NULL)
{ {
...@@ -1980,8 +1983,8 @@ static void kwsysProcessKill(pid_t process_id) ...@@ -1980,8 +1983,8 @@ static void kwsysProcessKill(pid_t process_id)
} }
else else
#endif #endif
#if defined(KWSYSPE_PS_COMMAND)
{ {
#if defined(KWSYSPE_PS_COMMAND)
/* Try running "ps" to get the process information. */ /* Try running "ps" to get the process information. */
FILE* ps = popen(KWSYSPE_PS_COMMAND, "r"); FILE* ps = popen(KWSYSPE_PS_COMMAND, "r");
...@@ -2005,8 +2008,8 @@ static void kwsysProcessKill(pid_t process_id) ...@@ -2005,8 +2008,8 @@ static void kwsysProcessKill(pid_t process_id)
{ {
pclose(ps); pclose(ps);
} }
}
#endif #endif
}
/* Kill the process. */ /* Kill the process. */
kill(process_id, SIGKILL); kill(process_id, SIGKILL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment