1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

Add a method to launch a child worker process while passing it additionnal command line arguments

This commit is contained in:
Léon 2025-07-02 17:01:58 +02:00
parent 52079652d0
commit 908cb9a2b5
2 changed files with 45 additions and 5 deletions

View file

@ -166,13 +166,27 @@ bool ChildProcessCoordinator::sendMessageToWorker (const MemoryBlock& mb)
bool ChildProcessCoordinator::launchWorkerProcess (const File& executable, const String& commandLineUniqueID,
int timeoutMs, int streamFlags)
{
killWorkerProcess();
auto pipeName = "p" + String::toHexString (Random().nextInt64());
StringArray args;
args.add (executable.getFullPathName());
args.add (getCommandLinePrefix (commandLineUniqueID) + pipeName);
return launchWorkerProcess(args, commandLineUniqueID, timeoutMs, streamFlags);
}
bool ChildProcessCoordinator::launchWorkerProcess(const StringArray& arguments, const String& commandLineUniqueID,
int timeoutMs, int streamFlags)
{
killWorkerProcess();
auto pipeName = "p" + String::toHexString(Random().nextInt64());
StringArray args;
args.add(arguments[0]);
args.add(getCommandLinePrefix(commandLineUniqueID) + pipeName);
if (arguments.size() > 1)
{
args.addArray(arguments.begin() + 1, arguments.end());
}
childProcess = [&]() -> std::shared_ptr<ChildProcess>
{