31 return activeProcess !=
nullptr && activeProcess->isRunning();
36 return activeProcess !=
nullptr ? activeProcess->read (dest, numBytes) : 0;
41 return activeProcess ==
nullptr || activeProcess->killProcess();
46 return activeProcess !=
nullptr ? activeProcess->getExitCode() : 0;
77 result.
write (buffer, (
size_t) num);
95 void runTest()
override
97 beginTest (
"Child Processes");
99 #if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX || JUCE_BSD
103 expect (p.start (
"tasklist"));
105 expect (p.start (
"ls /"));
108 auto output = p.readAllProcessOutput();
109 expect (output.isNotEmpty());
uint32 getExitCode() const
If the process has finished, this returns its exit code.
String readAllProcessOutput()
Blocks until the process has finished, and then returns its complete output as a string.
int readProcessOutput(void *destBuffer, int numBytesToRead)
Attempts to read some output from the child process.
~ChildProcess()
Destructor.
bool isRunning() const
Returns true if the child process is alive.
bool waitForProcessToFinish(int timeoutMs) const
Blocks until the process is no longer running.
bool kill()
Attempts to kill the child process.
ChildProcess()
Creates a process object.
Writes data to an internal memory buffer, which grows as required.
String toString() const
Attempts to detect the encoding of the data and convert it to a string.
bool write(const void *, size_t) override
Writes a block of data to the stream.
static void JUCE_CALLTYPE sleep(int milliseconds)
Suspends the execution of the current thread until the specified timeout period has elapsed (note tha...
static uint32 getMillisecondCounter() noexcept
Returns the number of millisecs since a fixed event (usually system startup).
This is a base class for classes that perform a unit test.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
unsigned int uint32
A platform-independent 32-bit unsigned integer type.