From 3eb0526468d07824900c462ccfacdeffd7fa1969 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 6 Mar 2017 16:16:56 -0800 Subject: Properly handle spaces in path when calling powershell script --- toolsrc/src/vcpkg_System.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'toolsrc/src/vcpkg_System.cpp') diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 679318768..9609d819b 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -49,6 +49,17 @@ namespace vcpkg::System return { ec, output }; } + std::wstring create_powershell_script_cmd(const fs::path& script_path) + { + return create_powershell_script_cmd(script_path, L""); + } + + std::wstring create_powershell_script_cmd(const fs::path& script_path, const std::wstring& args) + { + // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned + return Strings::wformat(LR"(powershell -ExecutionPolicy Bypass -Command "& {& '%s' %s}")", script_path.native(), args); + } + void print(const char* message) { fputs(message, stdout); -- cgit v1.2.3