private void setEnvironment(final RuntimeData data, final ProcessBuilder builder) { final Map<String, String> env = builder.environment(); if (!SystemConfiguration.getInstance().isOnWindows() && SystemConfiguration.getInstance().hasSpecialTclLib()) { env.put("TCL_LIBRARY", "/usr/share/tcl/tcl8.4/"); } if (data.getEnv() != null) { env.putAll(data.getEnv()); } }
private Process startRuntimeProcess(final RuntimeData rtData) { final String[] cmds = rtData.getCmdLine(); final File workingDirectory = new File(rtData.getWorkingDir()); try { ErlLogger.debug( "START node :> " + Arrays.toString(cmds) + " *** " + workingDirectory.getCanonicalPath()); } catch (final IOException e1) { ErlLogger.error("START ERROR node :> " + e1.getMessage()); } final ProcessBuilder builder = new ProcessBuilder(cmds); builder.directory(workingDirectory); setEnvironment(rtData, builder); try { final Process aProcess = builder.start(); return aProcess; } catch (final IOException e) { ErlLogger.error("Could not create runtime: %s", Arrays.toString(cmds)); ErlLogger.error(e); return null; } }