From 7305dfffe37ae446caecfd8d77a07eb8c21fff51 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 26 Nov 2023 12:11:53 +0100 Subject: [PATCH] Add ChildProcess::getPID() call Signed-off-by: falkTX --- modules/juce_core/native/juce_posix_SharedCode.h | 5 +++++ modules/juce_core/native/juce_win32_Threads.cpp | 5 +++++ modules/juce_core/threads/juce_ChildProcess.cpp | 5 +++++ modules/juce_core/threads/juce_ChildProcess.h | 2 ++ 4 files changed, 17 insertions(+) diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index ad46cf3902..13724ba7c7 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -1239,6 +1239,11 @@ public: return 0; } + int getPID() const noexcept + { + return childPID; + } + int childPID = 0; int pipeHandle = 0; int exitCode = -1; diff --git a/modules/juce_core/native/juce_win32_Threads.cpp b/modules/juce_core/native/juce_win32_Threads.cpp index 4a41481199..1c38ff2cf6 100644 --- a/modules/juce_core/native/juce_win32_Threads.cpp +++ b/modules/juce_core/native/juce_win32_Threads.cpp @@ -477,6 +477,11 @@ public: return (uint32) exitCode; } + int getPID() const noexcept + { + return 0; + } + bool ok; private: diff --git a/modules/juce_core/threads/juce_ChildProcess.cpp b/modules/juce_core/threads/juce_ChildProcess.cpp index 3b284c25a0..31e9c8d94a 100644 --- a/modules/juce_core/threads/juce_ChildProcess.cpp +++ b/modules/juce_core/threads/juce_ChildProcess.cpp @@ -81,6 +81,11 @@ String ChildProcess::readAllProcessOutput() } +uint32 ChildProcess::getPID() const noexcept +{ + return activeProcess != nullptr ? activeProcess->getPID() : 0; +} + //============================================================================== //============================================================================== #if JUCE_UNIT_TESTS diff --git a/modules/juce_core/threads/juce_ChildProcess.h b/modules/juce_core/threads/juce_ChildProcess.h index 47a26281b6..74dbb11ab2 100644 --- a/modules/juce_core/threads/juce_ChildProcess.h +++ b/modules/juce_core/threads/juce_ChildProcess.h @@ -101,6 +101,8 @@ public: */ bool kill(); + uint32 getPID() const noexcept; + private: //============================================================================== class ActiveProcess;