From 5ac3f106966686bf2723fe883dd0a60f8b406d13 Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Fri, 13 May 2005 14:44:20 -0400
Subject: [PATCH] ENH: Adding debugging code for freebsd.

---
 ProcessUNIX.c | 9 +++++++++
 testProcess.c | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/ProcessUNIX.c b/ProcessUNIX.c
index 9d09be8..91497f1 100644
--- a/ProcessUNIX.c
+++ b/ProcessUNIX.c
@@ -895,6 +895,15 @@ int kwsysProcess_WaitForData(kwsysProcess* cp, char** data, int* length,
       break;
       }
 
+#if defined(__FreeBSD__)
+    if(timeout && getenv("TEST_PROCESS_4"))
+      {
+      fprintf(stderr, "select with timeout %ld %ld\n",
+              timeout->tv_sec, timeout->tv_usec);
+      fflush(stderr);
+      }
+#endif
+
     /* Run select to block until data are available.  Repeat call
        until it is not interrupted.  */
     while(((numReady = select(max+1, &cp->PipeSet, 0, 0, timeout)) < 0) &&
diff --git a/testProcess.c b/testProcess.c
index 0237934..e5cf0f6 100644
--- a/testProcess.c
+++ b/testProcess.c
@@ -325,6 +325,12 @@ int main(int argc, const char* argv[])
     fprintf(stderr, "Output on stderr before test %d.\n", n);
     fflush(stdout);
     fflush(stderr);
+#if defined(__FreeBSD__)
+    if(n == 4)
+      {
+      putenv("TEST_PROCESS_4=1");
+      }
+#endif
     r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0,
                  outputs[n-1], delays[n-1], timeouts[n-1]);
     fprintf(stdout, "Output on stdout after test %d.\n", n);
-- 
GitLab