summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-01-14 23:39:25 +0000
committerDavid Robillard <d@drobilla.net>2007-01-14 23:39:25 +0000
commit88fdde74bb384530927bad3bdc97f9d79f4d22d2 (patch)
treebfd5c9c72bd44b9c04d12b28a3c600de6c0d6221
parent4750da9b51db11a4ccd194441ee40636792d7839 (diff)
downloadraul-88fdde74bb384530927bad3bdc97f9d79f4d22d2.tar.gz
raul-88fdde74bb384530927bad3bdc97f9d79f4d22d2.tar.bz2
raul-88fdde74bb384530927bad3bdc97f9d79f4d22d2.zip
Fixed launching of external ingen process from ingenuity.
git-svn-id: http://svn.drobilla.net/lad/raul@259 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--raul/Process.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/raul/Process.h b/raul/Process.h
index 68efb10..a8cf043 100644
--- a/raul/Process.h
+++ b/raul/Process.h
@@ -35,14 +35,14 @@ public:
*
* @param command can be a typical shell command with parameters, the PATH is searched etc.
*/
- bool launch(std::string command)
+ static bool launch(std::string command)
{
- const string executable = (command.find(" ") != string::npos)
+ const std::string executable = (command.find(" ") != std::string::npos)
? command.substr(0, command.find(" "))
: command;
std::cerr << "Launching child process '" << executable << "' with command line '"
- << command << "'" << endl;
+ << command << "'" << std::endl;
// Use the same double fork() trick as JACK to prevent zombie children
const int err = fork();
@@ -51,13 +51,13 @@ public:
// (child)
// close all nonstandard file descriptors
- const int max_fds = getdtablesize();
- int fd;
- for (fd = 3; fd < max_fds; ++fd)
+ struct rlimit max_fds;
+ getrlimit(RLIMIT_NOFILE, &max_fds);
+
+ for (rlim_t fd = 3; fd < max_fds.rlim_cur; ++fd)
close(fd);
switch (fork()) {
-
case 0:
// (grandchild)
setsid();
@@ -72,6 +72,7 @@ public:
default:
_exit (0);
}
+ }
return (err > 0);
}