From 5b328f1e1a1344bfdb17a6dfcf70732c9eada950 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 21 Mar 2024 17:54:58 +0800 Subject: [PATCH] - fix: Option 'Pause after run in console' for tools doesn't work. --- NEWS.md | 1 + RedPandaIDE/compiler/compilermanager.cpp | 6 ------ RedPandaIDE/compiler/compilermanager.h | 6 ++++++ RedPandaIDE/mainwindow.cpp | 16 ++++++++++++++-- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 853c18f2..411449c8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -70,6 +70,7 @@ Red Panda C++ Version 2.27 - fix: '*=' is treadted as '*' when parsing. - fix: Can't correctly retrieve function parameters type. - fix: Auto type induction for expression contains '[]' are not correct. + - fix: Option 'Pause after run in console' for tools doesn't work. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 7c3b9e4b..6339ddf1 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -36,12 +36,6 @@ #include #endif -enum RunProgramFlag { - RPF_PAUSE_CONSOLE = 0x0001, - RPF_REDIRECT_INPUT = 0x0002, - RPF_ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 -}; - CompilerManager::CompilerManager(QObject *parent) : QObject(parent), #if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) mCompileMutex(), diff --git a/RedPandaIDE/compiler/compilermanager.h b/RedPandaIDE/compiler/compilermanager.h index 76c3df25..9b5ae731 100644 --- a/RedPandaIDE/compiler/compilermanager.h +++ b/RedPandaIDE/compiler/compilermanager.h @@ -23,6 +23,12 @@ #include "../utils.h" #include "../common.h" +enum RunProgramFlag { + RPF_PAUSE_CONSOLE = 0x0001, + RPF_REDIRECT_INPUT = 0x0002, + RPF_ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 +}; + class Runner; class Project; class Compiler; diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 87dccc08..f765d7c2 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -3443,9 +3443,15 @@ void MainWindow::updateTools() + LINE_BREAKER); file.close(); if (item->pauseAfterExit) { + QString sharedMemoryId = QUuid::createUuid().toString(); + QStringList execArgs = QStringList{ + QString::number(RPF_PAUSE_CONSOLE), + sharedMemoryId, + localizePath(file.fileName()) + }; executeFile( includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+CONSOLE_PAUSER, - {"1", localizePath(file.fileName())}, + execArgs, workDir, file.fileName()); } else { executeFile( @@ -3456,9 +3462,15 @@ void MainWindow::updateTools() } } else { if (item->pauseAfterExit) { + QString sharedMemoryId = QUuid::createUuid().toString(); + QStringList execArgs = QStringList{ + QString::number(RPF_PAUSE_CONSOLE), + sharedMemoryId, + localizePath(program) + }; executeFile( includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+CONSOLE_PAUSER, - QStringList{"1", program} + params, + execArgs + params, workDir, ""); } else { executeFile(