From 567954425b67cafd5b72a4a29102095804d531a3 Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Thu, 10 Sep 2015 22:58:53 +0300 Subject: [PATCH] Return unsuccessful exit code if error occurs --- example/bench.cpp | 6 ++++-- example/example.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/example/bench.cpp b/example/bench.cpp index ba76e2a6..d80e7ce0 100644 --- a/example/bench.cpp +++ b/example/bench.cpp @@ -25,11 +25,12 @@ // // bench.cpp : spdlog benchmarks // +#include +#include // EXIT_FAILURE #include #include #include #include -#include #include "spdlog/spdlog.h" #include "spdlog/async_logger.h" #include "spdlog/sinks/file_sinks.h" @@ -108,8 +109,9 @@ int main(int argc, char* argv[]) { std::cerr << "Error: " << ex.what() << std::endl; perror("Last error"); + return EXIT_FAILURE; } - return 0; + return EXIT_SUCCESS; } diff --git a/example/example.cpp b/example/example.cpp index 6159770a..c1fffca0 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -25,6 +25,7 @@ // // spdlog usage example // +#include // EXIT_FAILURE #include #include "spdlog/spdlog.h" @@ -106,7 +107,9 @@ int main(int, char*[]) catch (const spd::spdlog_ex& ex) { std::cout << "Log failed: " << ex.what() << std::endl; + return EXIT_FAILURE; } + return EXIT_SUCCESS; }