1 // Copyright 2002 Adam Megacz, see the COPYING file for licensing [LGPL]
2 // see below for copyright information on the second portion of this file
11 jstring org::xwt::plat::POSIX::_getEnv(jstring key) {
12 int len = JvGetStringUTFLength(key);
14 JvGetStringUTFRegion(key, 0, len, buf);
16 char* envstr = getenv(buf);
17 return envstr == NULL ? NULL : JvNewStringLatin1(envstr);
20 void org::xwt::plat::POSIX::spawnChildProcess(JArray<jstring>* cmd) {
21 jstring* cmdstrings = elements(cmd);
22 char* cmd2[cmd->length + 1];
23 cmd2[cmd->length] = NULL;
24 for(int i=0; i<cmd->length; i++) {
25 cmd2[i] = (char*)malloc(JvGetStringUTFLength(cmdstrings[i]));
26 JvGetStringUTFRegion(cmdstrings[i], 0, JvGetStringUTFLength(cmdstrings[i]), cmd2[i]);
30 signal(SIGHUP, SIG_IGN);
31 signal(SIGQUIT, SIG_IGN);
32 signal(SIGINT, SIG_IGN);
33 signal(SIGTERM, SIG_IGN);
35 // ignore SIGPIPE in case we were launched from a browser and the browser closed
36 signal(SIGPIPE, SIG_IGN);
38 execvp(cmd2[0], cmd2);