diff options
| author | Martin Ridgers <[email protected]> | 2021-11-16 14:35:49 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-11-16 14:39:00 +0100 |
| commit | 688d88a4d92d6c316b248715a9d19ef65f3279ac (patch) | |
| tree | 12089228705408e910512182a7007ab02deea132 /zencore/include | |
| parent | Added a ZEN_EXE_STRING_LITERAL for cross-platform path building (diff) | |
| download | zen-688d88a4d92d6c316b248715a9d19ef65f3279ac.tar.xz zen-688d88a4d92d6c316b248715a9d19ef65f3279ac.zip | |
Added a zen::CreateProc() function for spawning child processes
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/thread.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/zencore/include/zencore/thread.h b/zencore/include/zencore/thread.h index 6727e5029..f0fc55413 100644 --- a/zencore/include/zencore/thread.h +++ b/zencore/include/zencore/thread.h @@ -6,6 +6,7 @@ #include <shared_mutex> +#include <filesystem> #include <string_view> #include <vector> @@ -174,6 +175,31 @@ private: int m_Pid = 0; }; +/** Basic process creation + */ +struct CreateProcOptions +{ + enum + { + Flag_NewConsole = 1 << 0, + Flag_Elevated = 1 << 1, + }; + + const std::filesystem::path* WorkingDirectory = nullptr; + uint32_t Flags = 0; +}; + +#if ZEN_PLATFORM_WINDOWS + using CreateProcResult = void*; // handle to the process +#else + using CreateProcResult = int32_t; // pid +#endif + +ZENCORE_API CreateProcResult CreateProc( + const std::filesystem::path& Executable, + std::string_view CommandLine, // should also include arg[0] (executable name) + const CreateProcOptions& Options={}); + /** Process monitor - monitors a list of running processes via polling Intended to be used to monitor a set of "sponsor" processes, where |