aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/checks.h3
-rw-r--r--toolsrc/include/vcpkg/base/system.process.h28
2 files changed, 26 insertions, 5 deletions
diff --git a/toolsrc/include/vcpkg/base/checks.h b/toolsrc/include/vcpkg/base/checks.h
index 3c0c073d2..519ca58f4 100644
--- a/toolsrc/include/vcpkg/base/checks.h
+++ b/toolsrc/include/vcpkg/base/checks.h
@@ -8,6 +8,9 @@ namespace vcpkg::Checks
{
void register_global_shutdown_handler(void (*func)());
+ // Note: for internal use
+ [[noreturn]] void final_cleanup_and_exit(const int exit_code);
+
// Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been
// broken.
[[noreturn]] void unreachable(const LineInfo& line_info);
diff --git a/toolsrc/include/vcpkg/base/system.process.h b/toolsrc/include/vcpkg/base/system.process.h
index 14e2eb109..b2e76ff74 100644
--- a/toolsrc/include/vcpkg/base/system.process.h
+++ b/toolsrc/include/vcpkg/base/system.process.h
@@ -3,6 +3,7 @@
#include <vcpkg/base/files.h>
#include <vcpkg/base/zstringview.h>
+#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
@@ -30,17 +31,34 @@ namespace vcpkg::System
std::string output;
};
- int cmd_execute_clean(const ZStringView cmd_line,
- const std::unordered_map<std::string, std::string>& extra_env = {},
- const std::string& prepend_to_path = {});
+ struct Environment
+ {
+#if defined(_WIN32)
+ std::wstring m_env_data;
+#endif
+ };
- int cmd_execute(const ZStringView cmd_line);
+ 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);
+ 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();
}