Explorar el Código

ENH: Added use of process execution.

Brad King hace 22 años
padre
commit
6e23bcb50f
Se han modificado 1 ficheros con 15 adiciones y 0 borrados
  1. 15 0
      Source/kwsys/test1.cxx

+ 15 - 0
Source/kwsys/test1.cxx

@@ -1,7 +1,22 @@
 #include <kwsys/Directory.hxx>
+#include <kwsys/Process.h>
+#include <kwsys/std/iostream>
 
 int main()
 {
   kwsys::Directory();
+  kwsysProcess* kp = kwsysProcess_New();
+  const char* cmd[] = {"echo", "Hello, World!", 0};
+  kwsysProcess_SetCommand(kp, cmd);
+  kwsysProcess_Execute(kp);
+  char* data = 0;
+  int length = 0;
+  while(kwsysProcess_WaitForData(kp, kwsysProcess_STDOUT | kwsysProcess_STDERR,
+                                 &data, &length, 0))
+    {
+    kwsys_std::cout.write(data, length);
+    }
+  kwsysProcess_Delete(kp);
+  kwsys_std::cout << kwsys_std::endl;
   return 0;
 }