Browse Source

Test code for juce+vfork

tags/1.9.4
falkTX 10 years ago
parent
commit
28b7d775f8
2 changed files with 30 additions and 8 deletions
  1. +10
    -8
      source/modules/juce_core/native/juce_posix_SharedCode.h
  2. +20
    -0
      source/utils/CarlaStringList.hpp

+ 10
- 8
source/modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -1008,7 +1008,14 @@ public:
if (pipe (pipeHandles) == 0)
{
const pid_t result = fork();
Array<char*> argv;
for (int i = 0; i < arguments.size(); ++i)
if (arguments[i].isNotEmpty())
argv.add (const_cast<char*> (arguments[i].toUTF8().getAddress()));
argv.add (nullptr);
const pid_t result = vfork();
if (result < 0)
{
@@ -1017,6 +1024,7 @@ public:
}
else if (result == 0)
{
#if 0
// we're the child process..
close (pipeHandles[0]); // close the read handle
@@ -1031,13 +1039,7 @@ public:
close (STDERR_FILENO);
close (pipeHandles[1]);
Array<char*> argv;
for (int i = 0; i < arguments.size(); ++i)
if (arguments[i].isNotEmpty())
argv.add (const_cast<char*> (arguments[i].toUTF8().getAddress()));
argv.add (nullptr);
#endif
execvp (argv[0], argv.getRawDataPointer());
exit (-1);


+ 20
- 0
source/utils/CarlaStringList.hpp View File

@@ -206,6 +206,26 @@ public:
return CharStringListPtr(*this);
}

CarlaStringList& operator=(const char* const* const charStringList) noexcept
{
clear();

for (int i=0; charStringList[i] != nullptr; ++i)
append(charStringList[i]);

return *this;
}

CarlaStringList& operator=(const CarlaStringList& list) noexcept
{
clear();

for (Itenerator it = list.begin(); it.valid(); it.next())
LinkedList<CarlaString>::append(it.getValue());

return *this;
}

private:
LinkedList<CarlaString> fList;
};


Loading…
Cancel
Save