exit_code_and_output -> ExitCodeAndOutput

This commit is contained in:
Alexander Karatarakis 2017-04-03 16:30:11 -07:00
parent 3f76b9e53d
commit 898edccbdc
5 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@ namespace vcpkg::System
{
fs::path get_exe_path_of_current_process();
struct exit_code_and_output
struct ExitCodeAndOutput
{
int exit_code;
std::string output;
@ -19,7 +19,7 @@ namespace vcpkg::System
int cmd_execute(const CWStringView cmd_line);
exit_code_and_output cmd_execute_and_capture_output(const CWStringView cmd_line);
ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line);
std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = L"");

View File

@ -244,7 +244,7 @@ namespace vcpkg::PostBuildLint
for (const fs::path& dll : dlls)
{
const std::wstring cmd_line = Strings::wformat(LR"("%s" /exports "%s")", dumpbin_exe.native(), dll.native());
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
if (ec_data.output.find("ordinal hint RVA name") == std::string::npos)
@ -275,7 +275,7 @@ namespace vcpkg::PostBuildLint
for (const fs::path& dll : dlls)
{
const std::wstring cmd_line = Strings::wformat(LR"("%s" /headers "%s")", dumpbin_exe.native(), dll.native());
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
if (ec_data.output.find("App Container") == std::string::npos)
@ -513,7 +513,7 @@ namespace vcpkg::PostBuildLint
for (const fs::path& lib : libs)
{
const std::wstring cmd_line = Strings::wformat(LR"("%s" /directives "%s")", dumpbin_exe.native(), lib.native());
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
for (const BuildType::Type& bad_build_type : bad_build_types)
@ -560,7 +560,7 @@ namespace vcpkg::PostBuildLint
for (const fs::path& dll : dlls)
{
const std::wstring cmd_line = Strings::wformat(LR"("%s" /dependents "%s")", dumpbin_exe.native(), dll.native());
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line));
for (const OutdatedDynamicCrt& outdated_crt : outdated_crts)

View File

@ -70,7 +70,7 @@ namespace vcpkg
{
const fs::path script = scripts_folder / "fetchDependency.ps1";
auto install_cmd = System::create_powershell_script_cmd(script, Strings::wformat(L"-Dependency %s", tool_name));
System::exit_code_and_output rc = System::cmd_execute_and_capture_output(install_cmd);
System::ExitCodeAndOutput rc = System::cmd_execute_and_capture_output(install_cmd);
if (rc.exit_code)
{
System::println(System::color::error, "Launching powershell failed or was denied");
@ -245,7 +245,7 @@ namespace vcpkg
{
const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1";
const std::wstring cmd = System::create_powershell_script_cmd(script);
System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd);
System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd);
Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances");
return Strings::split(ec_data.output, "\n");
}

View File

@ -96,7 +96,7 @@ namespace vcpkg::Commands::PortsDiff
static const std::string VALID_COMMIT_OUTPUT = "commit\n";
const std::wstring cmd = Strings::wformat(LR"("%s" cat-file -t %s)", git_exe.native(), git_commit_id);
const System::exit_code_and_output output = System::cmd_execute_and_capture_output(cmd);
const System::ExitCodeAndOutput output = System::cmd_execute_and_capture_output(cmd);
Checks::check_exit(VCPKG_LINE_INFO, output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id));
}

View File

@ -99,7 +99,7 @@ namespace vcpkg::System
return exit_code;
}
exit_code_and_output cmd_execute_and_capture_output(const CWStringView cmd_line)
ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line)
{
// Flush stdout before launching external process
fflush(stdout);