2022-01-24 18:37:06 +00:00
/***
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 ) ) ,
2022-01-27 07:45:42 +00:00
AUI_METHOD ( void , OnBuffered , ( const Memory : : ByteBuffer & , buffer ) ) ,
AUI_METHOD ( void , OnExit , ( AuUInt32 , exitCode ) )
2022-01-24 18:37:06 +00:00
) ;
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 ) ;
}