From de29e1aacb232de99bcbe84f77fe88f1a712ebcc Mon Sep 17 00:00:00 2001 From: MoAlyousef Date: Wed, 9 Sep 2020 15:19:03 +0300 Subject: [PATCH] use return value --- src/args.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/args.cpp b/src/args.cpp index 3608971..630325c 100644 --- a/src/args.cpp +++ b/src/args.cpp @@ -1,6 +1,7 @@ #include "args.hpp" #include "gen.hpp" #include "help.hpp" +#include #include #include @@ -24,12 +25,14 @@ std::string handle_args(std::vector &args) { } else if (main_arg == "build") { std::string command = "cmake -S. -Bbin "; if (args.size() > 2) { - for (int i = 2; i < args.size(); ++i) { + for (size_t i = 2; i < args.size(); ++i) { command += args[i] + " "; } } command += "&& cmake --build bin"; - auto _ = system(command.c_str()); + auto ret = system(command.c_str()); + if (ret) + return "Run faced an error!"; return "Run completed!"; } else { return "Unknown argument!";