mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
Use Checks::exit_fail/success/with_code()
This commit is contained in:
parent
4bc91f1f26
commit
c1fee48c08
@ -4,6 +4,7 @@
|
||||
#include "vcpkg_System.h"
|
||||
#include "vcpkg_Maps.h"
|
||||
#include "triplet.h"
|
||||
#include "vcpkg_Checks.h"
|
||||
|
||||
namespace vcpkg
|
||||
{
|
||||
@ -59,7 +60,7 @@ namespace vcpkg
|
||||
System::println(System::color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name);
|
||||
System::println("The following fields were not expected:\n\n %s\n\n", remaining_fields_as_string);
|
||||
System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", valid_fields_as_string);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ void invalid_command(const std::string& cmd)
|
||||
{
|
||||
System::println(System::color::error, "invalid command: %s", cmd);
|
||||
Commands::Help::print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
static void inner(const vcpkg_cmd_arguments& args)
|
||||
@ -30,7 +30,7 @@ static void inner(const vcpkg_cmd_arguments& args)
|
||||
if (args.command.empty())
|
||||
{
|
||||
Commands::Help::print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c()))
|
||||
@ -209,14 +209,14 @@ int wmain(const int argc, const wchar_t* const* const argv)
|
||||
if (g_debugging)
|
||||
{
|
||||
inner(args);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
std::string exc_msg;
|
||||
try
|
||||
{
|
||||
inner(args);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ namespace vcpkg::Environment
|
||||
{
|
||||
System::println(" %s", path.generic_string());
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
const fs::path& get_dumpbin_exe(const vcpkg_paths& paths)
|
||||
@ -129,7 +129,7 @@ namespace vcpkg::Environment
|
||||
{
|
||||
System::println(" %s", path.generic_string());
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths)
|
||||
|
@ -18,7 +18,7 @@ namespace vcpkg::Input
|
||||
// Intentionally show the lowercased string
|
||||
System::println(System::color::error, "Error: %s: %s", expected_spec.error_code().message(), as_lowercase);
|
||||
System::print(example_text);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
std::vector<package_spec> check_and_get_package_specs(const std::vector<std::string>& package_specs_as_strings, const triplet& default_target_triplet, const std::string& example_text)
|
||||
@ -39,7 +39,7 @@ namespace vcpkg::Input
|
||||
System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name());
|
||||
TrackProperty("error", "invalid triplet: " + t.canonical_name());
|
||||
Commands::Help::help_topic_valid_triplet(paths);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace vcpkg
|
||||
System::println(System::color::error, "Error: expected value after %s", option_name);
|
||||
TrackProperty("error", "error option name");
|
||||
Commands::Help::print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
if (option_field != nullptr)
|
||||
@ -25,7 +25,7 @@ namespace vcpkg
|
||||
System::println(System::color::error, "Error: %s specified multiple times", option_name);
|
||||
TrackProperty("error", "error option specified multiple times");
|
||||
Commands::Help::print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
option_field = std::make_unique<std::string>(*arg_begin);
|
||||
@ -41,7 +41,7 @@ namespace vcpkg
|
||||
System::println(System::color::error, "Error: conflicting values specified for --%s", option_name);
|
||||
TrackProperty("error", "error conflicting switches");
|
||||
Commands::Help::print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
option_field = new_setting;
|
||||
}
|
||||
@ -155,7 +155,7 @@ namespace vcpkg
|
||||
{
|
||||
System::println(option);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
return output;
|
||||
@ -183,7 +183,7 @@ namespace vcpkg
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires at most %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ namespace vcpkg
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires at least %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,7 +205,7 @@ namespace vcpkg
|
||||
{
|
||||
System::println(System::color::error, "Error: `%s` requires %u arguments, but %u were provided", this->command, expected_arg_count, actual_arg_count);
|
||||
System::print(example_text);
|
||||
exit(EXIT_FAILURE);
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace vcpkg
|
||||
System::println(System::color::error, "Launching powershell failed or was denied");
|
||||
TrackProperty("error", "powershell install failed");
|
||||
TrackProperty("installcmd", install_cmd);
|
||||
exit(rc.exit_code);
|
||||
Checks::exit_with_code(VCPKG_LINE_INFO, rc.exit_code);
|
||||
}
|
||||
|
||||
const fs::path actual_downloaded_path = Strings::trimmed(rc.output);
|
||||
|
Loading…
x
Reference in New Issue
Block a user