[-] AuProcesses::EStandardHandle

This commit is contained in:
Reece Wilson 2023-09-15 15:53:20 +01:00
parent d166a00d81
commit a80524d573
5 changed files with 30 additions and 15 deletions

View File

@ -10,8 +10,13 @@
namespace Aurora::IO
{
AUE_DEFINE_VA(EStandardStream,
// Process Input Stream
eInputStream,
// Process Output Stream
eOutputStream,
// Process Error Stream
eErrorStream
);
}

View File

@ -7,17 +7,10 @@
***/
#pragma once
#include <Aurora/IO/EStandardStream.hpp>
namespace Aurora::Processes
{
AUE_DEFINE(EStandardHandle,
(
// Process Input Stream
eStdIn,
using EStandardHandle = Aurora::IO::EStandardStream;
// Process Output Stream
eStdOut,
// Process Error Stream
eStdError
));
}

View File

@ -52,7 +52,6 @@ namespace Aurora::IO
return Aurora::IO::DupHandle(uOSHandle, bWriteAccess, false);
}
AuUInt64 AFileHandle::DupHandle(AuUInt64 uOSHandle, bool bWriteAccess, bool bShareAccess)
{
return Aurora::IO::DupHandle(uOSHandle, bWriteAccess, bShareAccess);

View File

@ -171,13 +171,19 @@ namespace Aurora::Processes
{
DWORD size = destination.length;
if (!EStandardHandleIsValid(stream) || (stream == EStandardHandle::eStdIn))
if (!IO::EStandardStreamIsValid(stream) || (stream == EStandardHandle::eInputStream))
{
SysPushErrorArg("Invalid Stream");
return {};
return false;
}
auto handle = stream == EStandardHandle::eStdError ? this->pipeStdErrRead_ : this->pipeStdOutRead_;
if (!destination)
{
SysPushErrorArg();
return false;
}
auto handle = stream == EStandardHandle::eErrorStream ? this->pipeStdErrRead_ : this->pipeStdOutRead_;
if (handle == INVALID_HANDLE_VALUE)
{
return false;

View File

@ -197,7 +197,19 @@ namespace Aurora::Processes
bool ProcessImpl::Read(EStandardHandle stream, const AuMemoryViewStreamWrite &destination, bool nonblock)
{
auto handle = stream == EStandardHandle::eStdError ? this->pipeStdErr_[0] : this->pipeStdOut_[0];
if (!IO::EStandardStreamIsValid(stream) || (stream == EStandardHandle::eInputStream))
{
SysPushErrorArg("Invalid Stream");
return false;
}
if (!destination)
{
SysPushErrorArg();
return false;
}
auto handle = stream == EStandardHandle::eErrorStream ? this->pipeStdErr_[0] : this->pipeStdOut_[0];
if (handle < 0)
{
SysPushErrorUninitialized();