threaded exception handling
Some checks failed
demo.yaml / threaded exception handling (push) Failing after 0s

This commit is contained in:
Jorijn van der Graaf 2025-11-15 19:20:33 +01:00
commit c2bb9023d4
14 changed files with 237 additions and 127 deletions

View file

@ -69,18 +69,25 @@ int main(int argc, char* argv[]) {
Project project = Project::LoadFromJSON(projectPath);
if(command == "build") {
Configuration& config = project.Build(argument);
if(run){
std::string binDir = std::format("{}/{}", project.binDir.string(), config.name);
if(config.debug) {
system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
//system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
} else {
system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
std::tuple<Configuration&, BuildResult> config = project.Build(argument);
std::cout << "amogus" << std::endl;
if(std::get<1>(config).errors.empty()) {
if(run){
std::string binDir = std::format("{}/{}", project.binDir.string(), std::get<0>(config).name);
if(std::get<0>(config).debug) {
system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
//system(std::format("cd {} && lldb -o run {}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
} else {
system(std::format("cd {} && ./{}", (fs::path(projectPath).parent_path()/binDir).string(), project.name).c_str());
}
}
return 0;
} else {
std::cout << std::get<1>(config).errors << std::endl;
return 1;
}
} else if(command == "test") {
bool anyFailed = false;
if(argument.empty()) {
std::vector<TestResult> results = project.RunTests();
for(const TestResult& result : results) {
@ -88,6 +95,7 @@ int main(int argc, char* argv[]) {
std::cout << std::format("✅ {}", result.name) << std::endl;
} else {
std::cout << std::format("❌ {}\t{}", result.name, result.message) << std::endl;
anyFailed = true;
}
}
} else {
@ -96,8 +104,11 @@ int main(int argc, char* argv[]) {
std::cout << std::format("✅ {}", result.name) << std::endl;
} else {
std::cout << std::format("❌ {}\t{}", result.name, result.message) << std::endl;
anyFailed = true;
}
}
return anyFailed ? 1 : 0;
} else {
std::println("Unkown command: {}", command);
}