Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #ifndef IPROCESSUTILS_H
  7. #define IPROCESSUTILS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "appframework/IAppSystem.h"
  12. //-----------------------------------------------------------------------------
  13. // Handle to a process
  14. //-----------------------------------------------------------------------------
  15. typedef int ProcessHandle_t;
  16. enum
  17. {
  18. PROCESS_HANDLE_INVALID = 0,
  19. };
  20. //-----------------------------------------------------------------------------
  21. // Interface version
  22. //-----------------------------------------------------------------------------
  23. #define PROCESS_UTILS_INTERFACE_VERSION "VProcessUtils001"
  24. //-----------------------------------------------------------------------------
  25. // Interface for makefiles to build differently depending on where they are run from
  26. //-----------------------------------------------------------------------------
  27. abstract_class IProcessUtils : public IAppSystem
  28. {
  29. public:
  30. // Starts, stops a process
  31. virtual ProcessHandle_t StartProcess( const char *pCommandLine, bool bConnectStdPipes ) = 0;
  32. virtual ProcessHandle_t StartProcess( int argc, const char **argv, bool bConnectStdPipes ) = 0;
  33. virtual void CloseProcess( ProcessHandle_t hProcess ) = 0;
  34. virtual void AbortProcess( ProcessHandle_t hProcess ) = 0;
  35. // Returns true if a process is complete
  36. virtual bool IsProcessComplete( ProcessHandle_t hProcess ) = 0;
  37. // Waits until a process is complete
  38. virtual void WaitUntilProcessCompletes( ProcessHandle_t hProcess ) = 0;
  39. // Methods used to write input into a process
  40. virtual int SendProcessInput( ProcessHandle_t hProcess, char *pBuf, int nBufLen ) = 0;
  41. // Methods used to read output back from a process
  42. virtual int GetProcessOutputSize( ProcessHandle_t hProcess ) = 0;
  43. virtual int GetProcessOutput( ProcessHandle_t hProcess, char *pBuf, int nBufLen ) = 0;
  44. // Returns the exit code for the process. Doesn't work unless the process is complete
  45. virtual int GetProcessExitCode( ProcessHandle_t hProcess ) = 0;
  46. };
  47. #endif // IPROCESSUTILS_H