aboutsummaryrefslogtreecommitdiff
path: root/src/test/test-child.c
diff options
context:
space:
mode:
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-07-22 15:57:56 +0100
committerSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-07-22 15:57:56 +0100
commit55a1cb53d6d1a8375afc12679b43901a977cf4b7 (patch)
tree20b51c49e441fd22bd34a06c87ae24022a22e652 /src/test/test-child.c
parentfec902dd6024dd170d151409387df5319b6e2ad0 (diff)
downloadtor-55a1cb53d6d1a8375afc12679b43901a977cf4b7.tar.gz
tor-55a1cb53d6d1a8375afc12679b43901a977cf4b7.zip
Add code to read all from a handle, but this block forever
See http://stackoverflow.com/questions/3722409/windows-child-process-with-redirected-input-and-output for a potential solution
Diffstat (limited to 'src/test/test-child.c')
-rw-r--r--src/test/test-child.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test-child.c b/src/test/test-child.c
index ca52750c2f..cf49c5d31e 100644
--- a/src/test/test-child.c
+++ b/src/test/test-child.c
@@ -1,4 +1,11 @@
#include <stdio.h>
+#include "orconfig.h"
+#ifdef MS_WINDOWS
+#define WINDOWS_LEAN_AND_MEAN
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
/** Trivial test program which prints out its command line arguments so we can
* check if tor_spawn_background() works */
@@ -11,7 +18,18 @@ main(int argc, char **argv)
fprintf(stderr, "ERR\n");
for (i = 1; i < argc; i++)
fprintf(stdout, "%s\n", argv[i]);
+ fprintf(stdout, "SLEEPING\n");
+#ifdef MS_WINDOWS
+ Sleep(1000);
+#else
+ sleep(1);
+#endif
fprintf(stdout, "DONE\n");
+#ifdef MS_WINDOWS
+ Sleep(1000);
+#else
+ sleep(1);
+#endif
return 0;
}