summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-05-20 22:50:27 (GMT)
committerBrad King <brad.king@kitware.com>2006-05-20 22:50:27 (GMT)
commit3dd70af5a0114ec8708c2ab06be647277a3067ac (patch)
tree16e7744d82376e1e4a24a5e1f2857b5589e90a84 /Source
parentf3ba74a4013e1c9444d03414e15201edc273366a (diff)
downloadCMake-3dd70af5a0114ec8708c2ab06be647277a3067ac.zip
CMake-3dd70af5a0114ec8708c2ab06be647277a3067ac.tar.gz
CMake-3dd70af5a0114ec8708c2ab06be647277a3067ac.tar.bz2
ENH: Enabling process tree killing on Cygwin.
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/ProcessUNIX.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 0f4d1bc..9eedad0 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -1909,12 +1909,15 @@ static pid_t kwsysProcessFork(kwsysProcess* cp,
#elif defined(__hpux) || defined(__sparc) || defined(__sgi) || defined(_AIX)
# define KWSYSPE_PS_COMMAND "ps -ef"
# 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
/*--------------------------------------------------------------------------*/
static void kwsysProcessKill(pid_t process_id)
{
-#if defined(__linux__)
+#if defined(__linux__) || defined(__CYGWIN__)
DIR* procdir;
#endif
@@ -1922,7 +1925,7 @@ static void kwsysProcessKill(pid_t process_id)
kill(process_id, SIGSTOP);
/* Kill all children if we can find them. */
-#if defined(__linux__)
+#if defined(__linux__) || defined(__CYGWIN__)
/* First try using the /proc filesystem. */
if((procdir = opendir("/proc")) != NULL)
{
@@ -1980,8 +1983,8 @@ static void kwsysProcessKill(pid_t process_id)
}
else
#endif
-#if defined(KWSYSPE_PS_COMMAND)
{
+#if defined(KWSYSPE_PS_COMMAND)
/* Try running "ps" to get the process information. */
FILE* ps = popen(KWSYSPE_PS_COMMAND, "r");
@@ -2005,8 +2008,8 @@ static void kwsysProcessKill(pid_t process_id)
{
pclose(ps);
}
- }
#endif
+ }
/* Kill the process. */
kill(process_id, SIGKILL);