18#include <AUI/IO/APath.h>
19#include <AUI/Common/AException.h>
20#include <AUI/Common/AVector.h>
21#include <AUI/Common/AObject.h>
22#include <AUI/Common/ASignal.h>
23#include <AUI/IO/IInputStream.h>
24#include <AUI/IO/IOutputStream.h>
25#include <AUI/Thread/AFuture.h>
28#include <AUI/Platform/win32/AWin32EventWait.h>
29#include <AUI/Platform/win32/WinIoAsync.h>
33#include "AUI/Platform/unix/UnixIoAsync.h"
46 MERGE_STDOUT_STDERR = 0b001,
82 virtual uint32_t
getPid() const noexcept = 0;
88 virtual
int waitForExitCode() = 0;
93 virtual
size_t processMemory() const = 0;
128 bool win32WrapWhitespaceArgumentsWithQuots =
true;
152 std::variant<ArgSingleString, ArgStringList>
args;
175 [[deprecated(
"use AProcess::create instead")]]
178 { .executable = std::move(applicationFile),
179 .args = ArgSingleString { std::move(
args) },
180 .workDir = std::move(workingDirectory) });
190 [[deprecated(
"use auto process = AProcess::make(); process->run(); process->waitForExitCode()")]]
191 static int executeWaitForExit(
193 ASubProcessExecutionFlags flags = ASubProcessExecutionFlags::DEFAULT);
203 static void executeAsAdministrator(
228 void kill() const noexcept;
241 const auto& getApplicationFile()
const {
242 return mInfo.executable;
246 const auto& getArgs()
const {
251 const auto& getWorkingDirectory()
const {
252 return mInfo.workDir;
256 return getApplicationFile();
261 if (mExitCode.hasValue()) {
268 bool isFinished() const noexcept {
269 return mExitCode.hasValue();
275 void run(ASubProcessExecutionFlags flags = ASubProcessExecutionFlags::DEFAULT);
283 uint32_t
getPid() const noexcept override;
301 ProcessCreationInfo mInfo;
308 PROCESS_INFORMATION mProcessInformation;
Definition: AProcess.h:234
APath getPathToExecutable() override
Definition: AProcess.h:255
Abstract AUI exception.
Definition: AException.h:29
Represents a value that will be available at some point in the future.
Definition: AFuture.h:620
A base object class.
Definition: AObject.h:49
Utility wrapper implementing the stack-allocated (fast) optional idiom.
Definition: AOptional.h:32
An add-on to AString with functions for working with the path.
Definition: APath.h:106
Definition: AProcess.h:57
Definition: AProcess.h:65
virtual uint32_t getPid() const noexcept=0
virtual APath getPathToExecutable()=0
virtual int waitForExitCode()=0
Wait for process to be finished and returns exit code.
static _< AChildProcess > make(AString applicationFile, AString args={}, APath workingDirectory={})
Launches an executable.
Definition: AProcess.h:176
virtual APath getModuleName()=0
virtual size_t processMemory() const =0
Obtain process memory usage.
An AVector with string-related functions.
Definition: AStringVector.h:22
Represents a Unicode character string.
Definition: AString.h:37
A std::vector with AUI extensions.
Definition: AVector.h:38
Encapsulates calls to RegisterWaitForSingleObject/UnregisterWait.
Definition: AWin32EventWait.h:21
Definition: IOutputStream.h:20
Definition: UnixIoAsync.h:18
Definition: WinIoAsync.h:19
An std::weak_ptr with AUI extensions.
Definition: SharedPtrTypes.h:177
API_AUI_CORE const ACommandLineArgs & args() noexcept
Definition: OSAndroid.cpp:29
AUI_ENUM_FLAG(ASubProcessExecutionFlags)
Flag enum for AChildProcess::run.
Definition: AProcess.h:42
@ DEFAULT
There's no concrete input action. Let the OS decide which action is the most appropriate.
Process arguments represented as a single string.
Definition: AProcess.h:101
Process arguments represented as array of strings.
Definition: AProcess.h:108
AStringVector list
Definition: AProcess.h:113
Process creation info.
Definition: AProcess.h:134
APath executable
Definition: AProcess.h:138
APath workDir
Definition: AProcess.h:158
std::variant< ArgSingleString, ArgStringList > args
Definition: AProcess.h:152
Forbids copy of your class.
Definition: values.h:40