[+] AuProcesses::IProcess::GetOutputAndInputHandles()

[+] AuProcesses::IProcess::GetErrorStreamHandle()
This commit is contained in:
Reece Wilson 2023-09-16 22:08:10 +01:00
parent 644c294c36
commit f13efd0cbf
5 changed files with 47 additions and 11 deletions

View File

@ -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<Threading::IWaitable> AsWaitable() = 0;
/**
* @brief Kernel synchronization primitive to synchronize against the process
*
*/
*/
virtual AuSPtr<IO::Loop::ILoopSource> 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<IO::IAsyncTransaction> NewAsyncTransaction() = 0;
/**
* @brief Returns an asynchronous file stream transaction of pipe pair: stderr, INVALID
* @return
*/
*/
virtual AuSPtr<IO::IAsyncTransaction> NewErrorStreamAsyncTransaction() = 0;
/**
* @brief returns the handle backing NewAsyncTransaction
* @return
*/
virtual AuSPtr<IO::IIOHandle> GetOutputAndInputHandles() = 0;
/**
* @brief returns the handle backing NewErrorStreamAsyncTransaction
* @return
*/
virtual AuSPtr<IO::IIOHandle> GetErrorStreamHandle() = 0;
};
}

View File

@ -496,6 +496,16 @@ namespace Aurora::Processes
return this->fsErrorStream_ ? this->fsErrorStream_->NewTransaction() : AuSPtr<AuIO::IAsyncTransaction> {};
}
AuSPtr<IO::IIOHandle> ProcessImpl::GetOutputAndInputHandles()
{
return this->fsHandle_;
}
AuSPtr<IO::IIOHandle> ProcessImpl::GetErrorStreamHandle()
{
return this->fsErrorHandle_;
}
bool ProcessImpl::Start()
{
if (this->process_ != INVALID_HANDLE_VALUE)

View File

@ -35,6 +35,8 @@ namespace Aurora::Processes
AuSPtr<IO::IAsyncTransaction> NewAsyncTransaction() override;
AuSPtr<IO::IAsyncTransaction> NewErrorStreamAsyncTransaction() override;
AuSPtr<IO::IIOHandle> GetOutputAndInputHandles() override;
AuSPtr<IO::IIOHandle> GetErrorStreamHandle() override;
bool Start() override;

View File

@ -471,6 +471,16 @@ namespace Aurora::Processes
return this->fsErrorStream_ ? this->fsErrorStream_->NewTransaction() : AuSPtr<AuIO::IAsyncTransaction> {};
}
AuSPtr<IO::IIOHandle> ProcessImpl::GetOutputAndInputHandles()
{
return this->fsHandle_;
}
AuSPtr<IO::IIOHandle> ProcessImpl::GetErrorStreamHandle()
{
return this->fsErrorHandle_;
}
void ProcessImpl::ForkMain()
{
{

View File

@ -46,6 +46,8 @@ namespace Aurora::Processes
AuSPtr<IO::IAsyncTransaction> NewAsyncTransaction() override;
AuSPtr<IO::IAsyncTransaction> NewErrorStreamAsyncTransaction() override;
AuSPtr<IO::IIOHandle> GetOutputAndInputHandles() override;
AuSPtr<IO::IIOHandle> GetErrorStreamHandle() override;
bool Start() override;