diff options
author | Brad King <brad.king@kitware.com> | 2003-06-10 19:50:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2003-06-10 19:50:45 (GMT) |
commit | 6e23bcb50fcb786b2a2be57839c7cbf81f6c13ec (patch) | |
tree | 40901adae40acb4b1a36b5cfca31575ae050d247 /Source | |
parent | 96ccaed54dcf97e802c2e958185cf321dfa7f1e4 (diff) | |
download | CMake-6e23bcb50fcb786b2a2be57839c7cbf81f6c13ec.zip CMake-6e23bcb50fcb786b2a2be57839c7cbf81f6c13ec.tar.gz CMake-6e23bcb50fcb786b2a2be57839c7cbf81f6c13ec.tar.bz2 |
ENH: Added use of process execution.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/test1.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/kwsys/test1.cxx b/Source/kwsys/test1.cxx index e46f02c..0957d3a 100644 --- a/Source/kwsys/test1.cxx +++ b/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; } |