|
|
|
|
@ -1942,6 +1942,14 @@ bool Window::on_key_press_event(GdkEventKey *event) {
|
|
|
|
|
auto run = command.run; |
|
|
|
|
boost::replace_all(run, "<path_match>", filesystem::escape_argument(path.string())); |
|
|
|
|
boost::replace_all(run, "<working_directory>", filesystem::escape_argument(run_path.string())); |
|
|
|
|
std::string label; |
|
|
|
|
if(!command.label.empty()) { |
|
|
|
|
label = command.label; |
|
|
|
|
boost::replace_all(label, "<path_match>", filesystem::escape_argument(path.string())); |
|
|
|
|
boost::replace_all(label, "<working_directory>", filesystem::escape_argument(run_path.string())); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
label = run; |
|
|
|
|
|
|
|
|
|
if(!compile.empty() || command.debug) { |
|
|
|
|
if(Project::debugging && command.debug) // Possibly continue current debugging
|
|
|
|
|
@ -1967,19 +1975,19 @@ bool Window::on_key_press_event(GdkEventKey *event) {
|
|
|
|
|
|
|
|
|
|
if(!command.debug) { |
|
|
|
|
Project::compiling = true; |
|
|
|
|
Terminal::get().print("\e[2mCompiling and running: " + run + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(compile, run_path, [run, run_path](int exit_status) { |
|
|
|
|
Terminal::get().print("\e[2mCompiling and running: " + label + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(compile, run_path, [run, run_path, label](int exit_status) { |
|
|
|
|
Project::compiling = false; |
|
|
|
|
if(exit_status == 0) { |
|
|
|
|
Terminal::get().async_process(run, run_path, [run](int exit_status) { |
|
|
|
|
Terminal::get().print("\e[2m" + run + " returned: " + (exit_status == 0 ? "\e[32m" : "\e[31m") + std::to_string(exit_status) + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(run, run_path, [label](int exit_status) { |
|
|
|
|
Terminal::get().print("\e[2m" + label + " returned: " + (exit_status == 0 ? "\e[32m" : "\e[31m") + std::to_string(exit_status) + "\e[m\n"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else { // Debug
|
|
|
|
|
Project::debugging = true; |
|
|
|
|
Terminal::get().print("\e[2mCompiling and debugging: " + run + "\e[m\n"); |
|
|
|
|
Terminal::get().print("\e[2mCompiling and debugging: " + label + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(compile, run_path, [project = project->shared_from_this(), run, run_path, debug_remote_host = command.debug_remote_host](int exit_status) { |
|
|
|
|
if(exit_status != EXIT_SUCCESS) |
|
|
|
|
Project::debugging = false; |
|
|
|
|
@ -1989,14 +1997,14 @@ bool Window::on_key_press_event(GdkEventKey *event) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if(!command.debug) { |
|
|
|
|
Terminal::get().async_print("\e[2mRunning: " + run + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(run, run_path, [run](int exit_status) { |
|
|
|
|
Terminal::get().print("\e[2m" + run + " returned: " + (exit_status == 0 ? "\e[32m" : "\e[31m") + std::to_string(exit_status) + "\e[m\n"); |
|
|
|
|
Terminal::get().async_print("\e[2mRunning: " + label + "\e[m\n"); |
|
|
|
|
Terminal::get().async_process(run, run_path, [label](int exit_status) { |
|
|
|
|
Terminal::get().print("\e[2m" + label + " returned: " + (exit_status == 0 ? "\e[32m" : "\e[31m") + std::to_string(exit_status) + "\e[m\n"); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else { // Debug
|
|
|
|
|
Project::debugging = true; |
|
|
|
|
Terminal::get().async_print("\e[2mDebugging: " + run + "\e[m\n"); |
|
|
|
|
Terminal::get().async_print("\e[2mDebugging: " + label + "\e[m\n"); |
|
|
|
|
project->debug_start(run, run_path, command.debug_remote_host); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
|