45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
/***
|
|
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: OutputOf.hpp
|
|
Date: 2023-12-23
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "StartupParameters.hpp"
|
|
|
|
namespace Aurora::Processes
|
|
{
|
|
AUKN_INTERFACE(IAsyncCallbacks,
|
|
AUI_METHOD(void, OnPipeData, ()),
|
|
AUI_METHOD(void, OnExit, ())
|
|
);
|
|
|
|
struct OutputOfResult
|
|
{
|
|
bool bFailed {};
|
|
bool bNoStart {};
|
|
AuString strStdout;
|
|
AuString strStderr;
|
|
AuUInt uExitCode {};
|
|
AuSInt sExitCode {};
|
|
};
|
|
|
|
struct IAsyncOutputOf
|
|
{
|
|
virtual OutputOfResult *GetResult() = 0;
|
|
virtual bool BlockUntilFinished() = 0;
|
|
virtual bool BlockUntilFinishedMS(AuUInt32 uRelMS) = 0;
|
|
virtual bool HasFinished() = 0;
|
|
virtual IProcess *GetProcess() = 0;
|
|
virtual bool TryAttachProcessExitToCompletionGroup(const AuSPtr<IO::CompletionGroup::ICompletionGroup> &pCompletionGroup) = 0;
|
|
virtual IO::CompletionGroup::ICompletionGroupWorkHandle *ToCompletionGroupHandle() = 0;
|
|
};
|
|
|
|
AUKN_SYM OutputOfResult OutputOf(StartupParameters &¶meters,
|
|
AuOptional<Memory::MemoryViewRead> toSend);
|
|
|
|
AUKN_SYM AuSPtr<IAsyncOutputOf> OutputOfAsync(StartupParameters &¶meters,
|
|
const AuSPtr<IAsyncCallbacks> &pCallbacks);
|
|
} |