cemu-vcpkg/toolsrc/include/vcpkg/base/system.process.h
Robert Schumacher f7fb56decd [vcpkg] Use CreateProcess on Windows. Improve EnvVars manipulation and handling. (#9897)
* [vcpkg] Rewrite process spawning on windows to always use CreateProcess, enabling better environment handling

* [vcpkg] Use environment cache to avoid calling vcvars multiple times

* [vcpkg] Increase buffer size while computing hashes

* [vcpkg] Remove unneeded cmd.exe wrapper process on all CreateProcess calls

* [vcpkg] Fix .vcxproj{,.filters}

* [vcpkg] Upgrade Ctrl-C state machine to handle multiple background processes.

* [vcpkg] Fix regression while launching metrics: 'start' can't be passed directly to CreateProcessW

* [vcpkg] Fix typo on non-Windows

* [vcpkg] Fix various uses of >NUL across the code

* [vcpkg] Fix various uses of >NUL across the code
2020-02-08 22:45:36 -08:00

65 lines
2.0 KiB
C++

#pragma once
#include <vcpkg/base/files.h>
#include <vcpkg/base/zstringview.h>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
namespace vcpkg::System
{
struct CMakeVariable
{
CMakeVariable(const StringView varname, const char* varvalue);
CMakeVariable(const StringView varname, const std::string& varvalue);
CMakeVariable(const StringView varname, const fs::path& path);
std::string s;
};
std::string make_cmake_cmd(const fs::path& cmake_exe,
const fs::path& cmake_script,
const std::vector<CMakeVariable>& pass_variables);
fs::path get_exe_path_of_current_process();
struct ExitCodeAndOutput
{
int exit_code;
std::string output;
};
struct Environment
{
#if defined(_WIN32)
std::wstring m_env_data;
#endif
};
const Environment& get_clean_environment();
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
const std::string& prepend_to_path = {});
int cmd_execute(const ZStringView cmd_line, const Environment& env = {});
int cmd_execute_clean(const ZStringView cmd_line);
#if defined(_WIN32)
Environment cmd_execute_modify_env(const ZStringView cmd_line, const Environment& env = {});
void cmd_execute_no_wait(const StringView cmd_line);
#endif
ExitCodeAndOutput cmd_execute_and_capture_output(const ZStringView cmd_line, const Environment& env = {});
int cmd_execute_and_stream_lines(const ZStringView cmd_line,
std::function<void(const std::string&)> per_line_cb,
const Environment& env = {});
int cmd_execute_and_stream_data(const ZStringView cmd_line,
std::function<void(StringView)> data_cb,
const Environment& env = {});
void register_console_ctrl_handler();
}