32 lines
987 B
C++
32 lines
987 B
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))
|
||
|
);
|
||
|
|
||
|
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);
|
||
|
}
|