diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-09-30 01:55:10 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-09-30 01:55:10 (GMT) |
commit | 375c695ba1a68fdbbd74e83c1f2c81c09efff534 (patch) | |
tree | 16c68da30fa3ed9ca9429c04b763af7cccf93f0f /Source/cmWin32ProcessExecution.h | |
parent | 4fe98d8068dd51f94d12e1227628e383622c993f (diff) | |
download | CMake-375c695ba1a68fdbbd74e83c1f2c81c09efff534.zip CMake-375c695ba1a68fdbbd74e83c1f2c81c09efff534.tar.gz CMake-375c695ba1a68fdbbd74e83c1f2c81c09efff534.tar.bz2 |
Fix for it to compile on "all" windows platforms...
Diffstat (limited to 'Source/cmWin32ProcessExecution.h')
-rw-r--r-- | Source/cmWin32ProcessExecution.h | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/Source/cmWin32ProcessExecution.h b/Source/cmWin32ProcessExecution.h index 49ab00e..b149a6b 100644 --- a/Source/cmWin32ProcessExecution.h +++ b/Source/cmWin32ProcessExecution.h @@ -27,7 +27,6 @@ #include "cmStandardIncludes.h" #include "windows.h" -#include "stdio.h" class cmMakefile; @@ -45,21 +44,59 @@ public: this->SetConsoleSpawn("w9xpopen.exe"); this->Initialize(); } + + /** + * Initialize the process execution datastructure. Do not call while + * running the process. + */ void Initialize() { this->m_ProcessHandle = 0; this->m_ExitValue = -1; - this->m_StdIn = 0; - this->m_StdOut = 0; - this->m_StdErr = 0; + // Comment this out. Maybe we will need it in the future. + // file IO access to the process might be cool. + //this->m_StdIn = 0; + //this->m_StdOut = 0; + //this->m_StdErr = 0; + this->m_pStdIn = -1; + this->m_pStdOut = -1; + this->m_pStdErr = -1; } + + /** + * Start the process in the directory path. Make sure that the + * executable is either in the path or specify the full path. The + * argument verbose specifies wether or not to display output while + * it is being generated. + */ bool StartProcess(const char*, const char* path, bool verbose); + + /** + * Wait for the process to finish. If timeout is specified, it will + * break the process after timeout expires. (Timeout code is not yet + * implemented. + */ bool Wait(int timeout); + + /** + * Get the output of the process (mixed stdout and stderr) as + * std::string. + */ const std::string GetOutput() const { return this->m_Output; } + + /** + * Get the return value of the process. If the process is still + * running, the return value is -1. + */ int GetExitValue() const { return this->m_ExitValue; } + /** + * On Windows 9x there is a bug in the process execution code which + * may result in blocking. That is why this workaround is + * used. Specify the console spawn, which should run the + * Windows9xHack code. + */ void SetConsoleSpawn(const char* prog) { this->m_ConsoleSpawn = prog; } - static int Windows9xHack(const char* command); private: @@ -67,10 +104,13 @@ private: bool PrivateClose(int timeout); HANDLE m_ProcessHandle; - FILE* m_StdIn; - FILE* m_StdOut; - FILE* m_StdErr; - + + // Comment this out. Maybe we will need it in the future. + // file IO access to the process might be cool. + // FILE* m_StdIn; + // FILE* m_StdOut; + // FILE* m_StdErr; + int m_pStdIn; int m_pStdOut; int m_pStdErr; |