aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-03-22 17:46:05 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-22 17:46:05 -0700
commitc1fee48c080abbbe0aec99b2e497cc7bd81a4908 (patch)
tree2d5f227ee232bcdcf78b551bf55cd1d499d72957
parent4bc91f1f269aa72dccd51a8f07134e4e66701793 (diff)
downloadvcpkg-c1fee48c080abbbe0aec99b2e497cc7bd81a4908.tar.gz
vcpkg-c1fee48c080abbbe0aec99b2e497cc7bd81a4908.zip
Use Checks::exit_fail/success/with_code()
-rw-r--r--toolsrc/src/SourceParagraph.cpp3
-rw-r--r--toolsrc/src/vcpkg.cpp8
-rw-r--r--toolsrc/src/vcpkg_Environment.cpp4
-rw-r--r--toolsrc/src/vcpkg_Input.cpp4
-rw-r--r--toolsrc/src/vcpkg_cmd_arguments.cpp14
-rw-r--r--toolsrc/src/vcpkg_paths.cpp2
6 files changed, 18 insertions, 17 deletions
diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp
index 4d144191f..3a9d71749 100644
--- a/toolsrc/src/SourceParagraph.cpp
+++ b/toolsrc/src/SourceParagraph.cpp
@@ -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);
}
}
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 6c81d54f9..f6acf07a0 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -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)
{
diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp
index f0c157b6e..ca68498ef 100644
--- a/toolsrc/src/vcpkg_Environment.cpp
+++ b/toolsrc/src/vcpkg_Environment.cpp
@@ -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)
diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp
index 5720cadc0..ac89981fb 100644
--- a/toolsrc/src/vcpkg_Input.cpp
+++ b/toolsrc/src/vcpkg_Input.cpp
@@ -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);
}
}
diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp
index 6ab6e9ee8..8c80e81fa 100644
--- a/toolsrc/src/vcpkg_cmd_arguments.cpp
+++ b/toolsrc/src/vcpkg_cmd_arguments.cpp
@@ -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);
}
}
}
diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp
index 867476e45..732c4a4fc 100644
--- a/toolsrc/src/vcpkg_paths.cpp
+++ b/toolsrc/src/vcpkg_paths.cpp
@@ -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);