Ark Server API (ASA) - Wiki
|
#include <MonitoredProcess.h>
Public Member Functions | |
FMonitoredProcess (const FString &InURL, const FString &InParams, bool InHidden, bool InCreatePipes=true) | |
FMonitoredProcess (const FString &InURL, const FString &InParams, const FString &InWorkingDir, bool InHidden, bool InCreatePipes=true) | |
virtual | ~FMonitoredProcess () |
void | Cancel (bool InKillTree=false) |
FTimespan | GetDuration () const |
FProcHandle | GetProcessHandle () const |
FString | GetCommandline () const |
bool | Update () |
virtual bool | Launch () |
void | SetSleepInterval (float InSleepInterval) |
FSimpleDelegate & | OnCanceled () |
FOnMonitoredProcessCompleted & | OnCompleted () |
FOnMonitoredProcessOutput & | OnOutput () |
int | GetReturnCode () const |
const FString & | GetFullOutputWithoutDelegate () const |
virtual bool | Init () override |
virtual uint32 | Run () override |
virtual void | Stop () override |
virtual void | Exit () override |
virtual FSingleThreadRunnable * | GetSingleThreadInterface () override |
Public Member Functions inherited from FRunnable | |
virtual | ~FRunnable () |
Protected Member Functions | |
void | Tick () override |
void | ProcessOutput (const FString &Output) |
void | TickInternal () |
TSAN_ATOMIC (bool) bIsRunning | |
Protected Attributes | |
bool | Canceling = false |
FDateTime | EndTime |
bool | Hidden = false |
bool | KillTree = false |
FString | Params |
FProcHandle | ProcessHandle |
void * | ReadPipe = nullptr |
int | ReturnCode = 0 |
FDateTime | StartTime { 0 } |
FRunnableThread * | Thread = nullptr |
FString | URL |
FString | WorkingDir |
void * | WritePipe = nullptr |
bool | bCreatePipes = false |
float | SleepInterval = 0.01f |
FString | OutputBuffer |
FSimpleDelegate | CanceledDelegate |
FOnMonitoredProcessCompleted | CompletedDelegate |
FOnMonitoredProcessOutput | OutputDelegate |
Additional Inherited Members | |
Private Member Functions inherited from FSingleThreadRunnable | |
virtual | ~FSingleThreadRunnable () |
Implements an external process that can be monitored.
Definition at line 35 of file MonitoredProcess.h.
FMonitoredProcess::FMonitoredProcess | ( | const FString & | InURL, |
const FString & | InParams, | ||
bool | InHidden, | ||
bool | InCreatePipes = true ) |
Creates a new monitored process.
InURL | The URL of the executable to launch. |
InParams | The command line parameters. |
InHidden | Whether the window of the process should be hidden. |
InCreatePipes | Whether the output should be redirected to the caller. |
FMonitoredProcess::FMonitoredProcess | ( | const FString & | InURL, |
const FString & | InParams, | ||
const FString & | InWorkingDir, | ||
bool | InHidden, | ||
bool | InCreatePipes = true ) |
Creates a new monitored process.
InURL | The URL of the executable to launch. |
InParams | The command line parameters. |
InHidden | Whether the window of the process should be hidden. |
InWorkingDir | The URL of the working dir where the executable should launch. |
InCreatePipes | Whether the output should be redirected to the caller. |
|
virtual |
Destructor.
Cancels the process.
InKillTree | Whether to kill the entire process tree when canceling this process. |
Definition at line 71 of file MonitoredProcess.h.
|
inline |
Returns the commandline of the process which will be executed if Launch is called
Definition at line 97 of file MonitoredProcess.h.
FTimespan FMonitoredProcess::GetDuration | ( | ) | const |
Gets the duration of time that the task has been running.
Returns the full output, wihtout needing to hookup a delegate and buffer it externally. Note that if OutputDelegate is bound, this will not have the entire output
Definition at line 168 of file MonitoredProcess.h.
|
inline |
Gets the Process Handle. The instance can be invalid if the process was not created.
Definition at line 89 of file MonitoredProcess.h.
|
inline |
Returns the return code from the exited process
Definition at line 159 of file MonitoredProcess.h.
|
inlineoverridevirtual |
Gets single thread interface pointer used for ticking this runnable when multi-threading is disabled. If the interface is not implemented, this runnable will not be ticked when FPlatformProcess::SupportsMultithreading() is false.
Reimplemented from FRunnable.
Definition at line 191 of file MonitoredProcess.h.
Initializes the runnable object.
This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.
Reimplemented from FRunnable.
Definition at line 177 of file MonitoredProcess.h.
Launches the process.
Reimplemented in FSerializedUATProcess.
|
inline |
Returns a delegate that is executed when the process has been canceled.
Definition at line 129 of file MonitoredProcess.h.
|
inline |
Returns a delegate that is executed when a monitored process completed.
Definition at line 139 of file MonitoredProcess.h.
|
inline |
Returns a delegate that is executed when a monitored process produces output.
Definition at line 149 of file MonitoredProcess.h.
Processes the given output string.
Output | The output string to process. |
Sets the sleep interval to be used in the main thread loop.
InSleepInterval | The Sleep interval to use. |
Definition at line 117 of file MonitoredProcess.h.
|
overrideprotectedvirtual |
FSingleThreadRunnable interface
Implements FSingleThreadRunnable.
|
protected |
|
protected |
bool FMonitoredProcess::Update | ( | ) |
Checks whether the process is still running. In single threaded mode, this will tick the thread processing
Definition at line 257 of file MonitoredProcess.h.
|
protected |
Definition at line 268 of file MonitoredProcess.h.
Definition at line 215 of file MonitoredProcess.h.
|
protected |
Definition at line 271 of file MonitoredProcess.h.
|
protected |
Definition at line 218 of file MonitoredProcess.h.
Definition at line 221 of file MonitoredProcess.h.
Definition at line 224 of file MonitoredProcess.h.
|
protected |
Definition at line 263 of file MonitoredProcess.h.
|
protected |
Definition at line 274 of file MonitoredProcess.h.
|
protected |
Definition at line 227 of file MonitoredProcess.h.
|
protected |
Definition at line 230 of file MonitoredProcess.h.
Definition at line 233 of file MonitoredProcess.h.
|
protected |
Definition at line 236 of file MonitoredProcess.h.
|
protected |
Definition at line 260 of file MonitoredProcess.h.
|
protected |
Definition at line 239 of file MonitoredProcess.h.
|
protected |
Definition at line 242 of file MonitoredProcess.h.
|
protected |
Definition at line 248 of file MonitoredProcess.h.
|
protected |
Definition at line 251 of file MonitoredProcess.h.
Definition at line 254 of file MonitoredProcess.h.