Reece
5bc1985eca
[*] Added const modifier to cpuid functions [*] Added OnExit to planned API interface [*] BlobReader now holds onto a handle of a ByteBuffer, allowing for shared usage -> aiding in the mitigation of allocations/second and needless heavy copy of objects
33 lines
1.0 KiB
C++
33 lines
1.0 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: UtilRun.hpp
|
|
Date:
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Processes
|
|
{
|
|
AUKN_INTERFACE(ICommandFinished,
|
|
AUI_METHOD(void, OnLines, (const AuList<AuString> &, buffer)),
|
|
AUI_METHOD(void, OnBuffered, (const Memory::ByteBuffer &, buffer)),
|
|
AUI_METHOD(void, OnExit, (AuUInt32, exitCode))
|
|
);
|
|
|
|
struct CommandRun_s
|
|
{
|
|
AuString cmd;
|
|
AuList<AuString> args;
|
|
Memory::ByteBuffer stdIn;
|
|
bool stdOutLongerThan64k {false}; // common constraint on linux and windows, at the very least. linux -> max pipe = 16k, windows -> 16k minimum guaranteed
|
|
bool stdOutIsText {true};
|
|
bool runCallbackOnRandomThread {true};
|
|
bool runCallbackOnWorkerPId {};
|
|
Async::WorkerPId_t worker;
|
|
bool syncToResult {}; // default -> async
|
|
AuSPtr<ICommandFinished> callback;
|
|
};
|
|
|
|
AUKN_SYM void RunCommand(const CommandRun_s &in);
|
|
} |