From 74f1fd223d55c463bb41b7ab90dff62c38aa1752 Mon Sep 17 00:00:00 2001 From: Mirek Fidler Date: Fri, 31 Jul 2026 11:16:58 +0200 Subject: [PATCH] ide, Core: Console application started by F5 (debug) now waits before closing the console window --- uppsrc/Core/App.cpp | 7 +++++++ uppsrc/ide/Builders/Build.cpp | 8 +++++--- uppsrc/ide/Builders/Build.h | 4 ++-- uppsrc/ide/Debug.cpp | 6 +++--- uppsrc/ide/ide.h | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/uppsrc/Core/App.cpp b/uppsrc/Core/App.cpp index 94f1f5d7f..55843923f 100644 --- a/uppsrc/Core/App.cpp +++ b/uppsrc/Core/App.cpp @@ -621,6 +621,13 @@ void AppExit__() #ifdef PLATFORM_POSIX MemoryIgnoreLeaksBegin(); // Qt leaks on app exit... #endif + +#ifndef flagGUI + if(GetEnv("UPP_EXIT_PAUSE__") == "1") { // this is an ugly way to prevent close of console on F5 (debug) + Cout() << "<--- Finished, press [ENTER] to close the window --->\n"; + ReadStdIn(); + } +#endif } #ifdef flagTURTLE // Turtle web backend diff --git a/uppsrc/ide/Builders/Build.cpp b/uppsrc/ide/Builders/Build.cpp index 7df0ac1bd..3ddf16115 100644 --- a/uppsrc/ide/Builders/Build.cpp +++ b/uppsrc/ide/Builders/Build.cpp @@ -94,7 +94,7 @@ String NoCr(const char *s) return out; } -void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale) +void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale, bool exit_pause) { VectorMap bm = GetMethodVars(method); { @@ -116,6 +116,8 @@ void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool env.GetAdd("UPP_DARKMODE__") = "1"; if(scale) env.GetAdd("UPP_SCALE__") = AsString(scale); + if(exit_pause) + env.GetAdd("UPP_EXIT_PAUSE__") = "1"; // setup LD_LIBRARY_PATH on target dir, needed for all shared builds on posix #ifdef PLATFORM_POSIX if(target != "") @@ -147,10 +149,10 @@ void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool } } -void MakeBuild::CreateHost(Host& host, bool darkmode, bool disable_uhd, int scale) +void MakeBuild::CreateHost(Host& host, bool darkmode, bool disable_uhd, int scale, bool exit_pause) { SetupDefaultMethod(); - CreateHost(host, method, darkmode, disable_uhd, scale); + CreateHost(host, method, darkmode, disable_uhd, scale, exit_pause); } One MakeBuild::CreateBuilder(Host *host) diff --git a/uppsrc/ide/Builders/Build.h b/uppsrc/ide/Builders/Build.h index bf3426082..d72c06ad9 100644 --- a/uppsrc/ide/Builders/Build.h +++ b/uppsrc/ide/Builders/Build.h @@ -68,8 +68,8 @@ public: bool makefile_svn_revision = true; - void CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale); - void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false, int scale = 0); + void CreateHost(Host& host, const String& method, bool darkmode, bool disable_uhd, int scale, bool exit_pause); + void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false, int scale = 0, bool exit_pause = false); const TargetMode& GetTargetMode(); Index PackageConfig(const Workspace& wspc, int package, const VectorMap& bm, diff --git a/uppsrc/ide/Debug.cpp b/uppsrc/ide/Debug.cpp index 6cabfd0c6..b2166bf86 100644 --- a/uppsrc/ide/Debug.cpp +++ b/uppsrc/ide/Debug.cpp @@ -115,9 +115,9 @@ void Ide::RunArgs() { } } -void Ide::CreateHostRunDir(Host& h) +void Ide::CreateHostRunDir(Host& h, bool exit_pause) { - CreateHost(h, darkmode, disable_uhd, scale); + CreateHost(h, darkmode, disable_uhd, scale, exit_pause); if(IsNull(rundir)) h.ChDir(GetFileFolder(target)); else @@ -358,7 +358,7 @@ void Ide::BuildAndDebug(bool runto) if(designer && !editfile_isfolder) EditAsText(); Host host; - CreateHostRunDir(host); + CreateHostRunDir(host, true); host.ChDir(Nvl(rundir, GetFileFolder(target))); editor.Disable(); diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index 2faf29504..6356263f0 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -965,7 +965,7 @@ public: void FileCompile(); void Preprocess(bool asmout); void ToggleStopOnErrors(); - void CreateHostRunDir(Host& h); + void CreateHostRunDir(Host& h, bool exit_pause = false); void DebugMenu(Bar& menu); void RunArgs();