diff --git a/Include/Aurora/Processes/IProcess.hpp b/Include/Aurora/Processes/IProcess.hpp index 47782d33..e44fdfe5 100644 --- a/Include/Aurora/Processes/IProcess.hpp +++ b/Include/Aurora/Processes/IProcess.hpp @@ -22,38 +22,38 @@ namespace Aurora::Processes * using this over the loop source. Won't remove. Has legitmate * use cases. You could use this lock state as 'has terminated' * @return - */ + */ virtual AuSPtr AsWaitable() = 0; /** * @brief Kernel synchronization primitive to synchronize against the process * - */ + */ virtual AuSPtr AsLoopSource() = 0; /** * @brief returns the exit code of the process should we outlive them * @return - */ + */ virtual AuSInt GetExitCode() = 0; /** * @brief returns *something* about the process. you should not use this * @return - */ + */ virtual AuUInt GetProcessId() = 0; /** * @brief Creates the process, for the first and only time, given the input * StartupParameters provided to the relevant Spawn function * @return - */ + */ virtual bool Start() = 0; /** * @brief Forcefully terminates the process * @return - */ + */ virtual bool Terminate() = 0; /** @@ -62,7 +62,7 @@ namespace Aurora::Processes terminate key sequence to the process * @return whether or not the thread is still alive at the end of the kill * attempt. - */ + */ virtual bool TryKill() = 0; /** @@ -73,26 +73,38 @@ namespace Aurora::Processes * If the input span is null, outVariable is assigned the available bytes in the IPC buffer * @param nonblock * @return - */ + */ virtual bool Read(EStandardHandle stream, const Memory::MemoryViewStreamWrite &destination, bool nonblock = true) = 0; /** * @brief Synchronously writes `source` bytes to the processes stdin stream * @param source * @return - */ + */ virtual bool Write(const Memory::MemoryViewStreamRead &source) = 0; /** * @brief Returns an asynchronous file stream transaction of pipe pair: stdout, stdin * @return - */ + */ virtual AuSPtr NewAsyncTransaction() = 0; /** * @brief Returns an asynchronous file stream transaction of pipe pair: stderr, INVALID * @return - */ + */ virtual AuSPtr NewErrorStreamAsyncTransaction() = 0; + + /** + * @brief returns the handle backing NewAsyncTransaction + * @return + */ + virtual AuSPtr GetOutputAndInputHandles() = 0; + + /** + * @brief returns the handle backing NewErrorStreamAsyncTransaction + * @return + */ + virtual AuSPtr GetErrorStreamHandle() = 0; }; } \ No newline at end of file diff --git a/Source/Processes/AuProcess.NT.cpp b/Source/Processes/AuProcess.NT.cpp index 259d95aa..4a2881d0 100644 --- a/Source/Processes/AuProcess.NT.cpp +++ b/Source/Processes/AuProcess.NT.cpp @@ -496,6 +496,16 @@ namespace Aurora::Processes return this->fsErrorStream_ ? this->fsErrorStream_->NewTransaction() : AuSPtr {}; } + AuSPtr ProcessImpl::GetOutputAndInputHandles() + { + return this->fsHandle_; + } + + AuSPtr ProcessImpl::GetErrorStreamHandle() + { + return this->fsErrorHandle_; + } + bool ProcessImpl::Start() { if (this->process_ != INVALID_HANDLE_VALUE) diff --git a/Source/Processes/AuProcess.NT.hpp b/Source/Processes/AuProcess.NT.hpp index 86b1c0fc..a22ee925 100644 --- a/Source/Processes/AuProcess.NT.hpp +++ b/Source/Processes/AuProcess.NT.hpp @@ -35,6 +35,8 @@ namespace Aurora::Processes AuSPtr NewAsyncTransaction() override; AuSPtr NewErrorStreamAsyncTransaction() override; + AuSPtr GetOutputAndInputHandles() override; + AuSPtr GetErrorStreamHandle() override; bool Start() override; diff --git a/Source/Processes/AuProcess.Unix.cpp b/Source/Processes/AuProcess.Unix.cpp index 8103c228..9d8ddd51 100644 --- a/Source/Processes/AuProcess.Unix.cpp +++ b/Source/Processes/AuProcess.Unix.cpp @@ -471,6 +471,16 @@ namespace Aurora::Processes return this->fsErrorStream_ ? this->fsErrorStream_->NewTransaction() : AuSPtr {}; } + AuSPtr ProcessImpl::GetOutputAndInputHandles() + { + return this->fsHandle_; + } + + AuSPtr ProcessImpl::GetErrorStreamHandle() + { + return this->fsErrorHandle_; + } + void ProcessImpl::ForkMain() { { diff --git a/Source/Processes/AuProcess.Unix.hpp b/Source/Processes/AuProcess.Unix.hpp index 5c12b589..6382a9fd 100644 --- a/Source/Processes/AuProcess.Unix.hpp +++ b/Source/Processes/AuProcess.Unix.hpp @@ -46,6 +46,8 @@ namespace Aurora::Processes AuSPtr NewAsyncTransaction() override; AuSPtr NewErrorStreamAsyncTransaction() override; + AuSPtr GetOutputAndInputHandles() override; + AuSPtr GetErrorStreamHandle() override; bool Start() override;