LMMS
Loading...
Searching...
No Matches
ChildProcess Class Reference

#include <ChildProcess.h>

Classes

class  ActiveProcess

Public Types

enum  Type { TypeAny , TypeARM , TypeIntel }

Public Member Functions

 ChildProcess ()
 ~ChildProcess ()
bool start (const String &command, Type type=TypeAny)
bool start (const StringArray &arguments, Type type=TypeAny)
bool isRunning () const
bool waitForProcessToFinish (int timeoutMs)
uint32 getExitCodeAndClearPID ()
bool kill ()
bool terminate ()
uint32 getPID () const noexcept

Private Attributes

CarlaScopedPointer< ActiveProcessactiveProcess

Detailed Description

Launches and monitors a child process.

This class lets you launch an executable, and read its output. You can also use it to check whether the child process has finished.

Member Enumeration Documentation

◆ Type

Child process type, only used in macOS.

Enumerator
TypeAny 
TypeARM 
TypeIntel 

Constructor & Destructor Documentation

◆ ChildProcess()

Creates a process object. To actually launch the process, use start().

◆ ~ChildProcess()

Destructor. Note that deleting this object won't terminate the child process.

Member Function Documentation

◆ getExitCodeAndClearPID()

If the process has finished, this returns its exit code and also clears assigned PID.

◆ getPID()

uint32 water::ChildProcess::getPID ( ) const
noexcept

◆ isRunning()

Returns true if the child process is alive.

◆ kill()

Attempts to kill the child process. Returns true if it succeeded. Trying to read from the process after calling this may result in undefined behaviour.

◆ start() [1/2]

bool water::ChildProcess::start ( const String & command,
Type type = TypeAny )

Attempts to launch a child process command.

The command should be the name of the executable file, followed by any arguments that are required. If the process has already been launched, this will launch it again. If a problem occurs, the method will return false. The streamFlags is a combinations of values to indicate which of the child's output streams should be read and returned by readProcessOutput().

◆ start() [2/2]

bool water::ChildProcess::start ( const StringArray & arguments,
Type type = TypeAny )

Attempts to launch a child process command.

The first argument should be the name of the executable file, followed by any other arguments that are needed. If the process has already been launched, this will launch it again. If a problem occurs, the method will return false. The streamFlags is a combinations of values to indicate which of the child's output streams should be read and returned by readProcessOutput().

◆ terminate()

◆ waitForProcessToFinish()

Blocks until the process is no longer running.

Member Data Documentation

◆ activeProcess


The documentation for this class was generated from the following files: