From 66966e6453c320bcb4d08f1b731fb410a504cbc2 Mon Sep 17 00:00:00 2001 From: "lucas.sproule" Date: Wed, 1 Nov 2023 23:01:54 -0400 Subject: [PATCH] idfk man --- src/Command/CommandDev.cpp | 5 ++++- src/Command/CommandHelp.cpp | 6 +++++- src/Command/CommandRun.cpp | 18 +++++++++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/Command/CommandDev.cpp b/src/Command/CommandDev.cpp index 86ecd81..84e4b86 100644 --- a/src/Command/CommandDev.cpp +++ b/src/Command/CommandDev.cpp @@ -128,7 +128,10 @@ namespace Command { const std::string command = "cmake . && make && ./" + ctx->build_dir + "/" + ctx->project_name + " " + command_args; #endif - system(command.c_str()); + int success = system(command.c_str()); + if (success != 0) { + std::cout << "Error running project" << std::endl; + } // Call your recompilation command or any other action you want },path); diff --git a/src/Command/CommandHelp.cpp b/src/Command/CommandHelp.cpp index 5fc9339..cd98edd 100644 --- a/src/Command/CommandHelp.cpp +++ b/src/Command/CommandHelp.cpp @@ -10,7 +10,11 @@ namespace Command { if ((static_cast(std::getenv("TERM")) == "xterm-kitty")){ struct winsize w = {500, 500, 0, 0}; ioctl(0, TIOCGWINSZ, &w); - system("kitty +kitten icat --align left ~/Downloads/logo.png"); + int success = system("kitty +kitten icat --align left ~/Downloads/logo.png"); + if (success != 0) { + std::cout << "Error printing logo" << std::endl; + return false; + } } std::cout << "usage: "<< termcolor::green << "cmaker"<< termcolor::reset <<" " << ENDL diff --git a/src/Command/CommandRun.cpp b/src/Command/CommandRun.cpp index 34e205f..6cfc152 100644 --- a/src/Command/CommandRun.cpp +++ b/src/Command/CommandRun.cpp @@ -5,8 +5,16 @@ namespace Command { bool Interface::run(){ #ifdef DEBUG - system("mkdir -p build/build/"); - system("cd build && cmake . && make && cd .."); + int success = system("mkdir -p build/build/"); + if (success != 0) { + std::cout << "Error creating build directory" << std::endl; + return false; + } + success = system("cd build && cmake . && make && cd .."); + if (success != 0) { + std::cout << "Error building project" << std::endl; + return false; + } #else system("mkdir -p build"); system("cmake . "); @@ -17,7 +25,11 @@ namespace Command { file_name = "./build/build/"; #endif std::string command = file_name + ctx->project_name; - system(command.c_str()); + success = system(command.c_str()); + if (success != 0) { + std::cout << "Error running project" << std::endl; + return false; + } return true; } }