public ProcessExecutionResults executeProcess(ProcessExecution processExecution) { // TODO: doesn't look like SIGAR has an API to fork/execute processes? fallback to using the Java way return SystemInfoFactory.createJavaSystemInfo().executeProcess(processExecution); }
public ProcessExecutionResults executeProcess(ProcessExecution processExecution) { // TODO: doesn't look like SIGAR has an API to fork/execute processes? fallback to using the Java way return SystemInfoFactory.createJavaSystemInfo().executeProcess(processExecution); }
public Map<String, String> getEnvironmentVariables() { if (this.procEnv == null) { return Collections.emptyMap(); } if (this.environmentVariables == null) { this.environmentVariables = new HashMap<String, String>(this.procEnv.size()); SystemInfo systemInfo = SystemInfoFactory.createJavaSystemInfo(); boolean isWindows = systemInfo.getOperatingSystemType() == OperatingSystemType.WINDOWS; if (isWindows) { // Windows environment is case-insensitive so convert variable names to all-caps, // this way we will be able to do case-insensitive lookups from the map later for (Map.Entry<String, String> env : this.procEnv.entrySet()) { this.environmentVariables.put(env.getKey().toUpperCase(), env.getValue()); } } else { this.environmentVariables.putAll(procEnv); } } return this.environmentVariables; }
public Map<String, String> getEnvironmentVariables() { if (this.procEnv == null) { return Collections.emptyMap(); } if (this.environmentVariables == null) { this.environmentVariables = new HashMap<String, String>(this.procEnv.size()); SystemInfo systemInfo = SystemInfoFactory.createJavaSystemInfo(); boolean isWindows = systemInfo.getOperatingSystemType() == OperatingSystemType.WINDOWS; if (isWindows) { // Windows environment is case-insensitive so convert variable names to all-caps, // this way we will be able to do case-insensitive lookups from the map later for (Map.Entry<String, String> env : this.procEnv.entrySet()) { this.environmentVariables.put(env.getKey().toUpperCase(), env.getValue()); } } else { this.environmentVariables.putAll(procEnv); } } return this.environmentVariables; }
/** * Retrieves a specific environment property if it exists, <code>null</code> otherwise. * * @param name the name of the property to find * * @return the environment value */ @Nullable public String getEnvironmentVariable(@NotNull String name) { if (this.procEnv == null) { return null; } SystemInfo systemInfo = SystemInfoFactory.createJavaSystemInfo(); boolean isWindows = systemInfo.getOperatingSystemType() == OperatingSystemType.WINDOWS; // Windows env names are case insensitive, so convert the specified name to all-caps before doing the lookup. return getEnvironmentVariables().get((isWindows) ? name.toUpperCase() : name); }
/** * Retrieves a specific environment property if it exists, <code>null</code> otherwise. * * @param name the name of the property to find * * @return the environment value */ @Nullable public String getEnvironmentVariable(@NotNull String name) { if (this.procEnv == null) { return null; } SystemInfo systemInfo = SystemInfoFactory.createJavaSystemInfo(); boolean isWindows = systemInfo.getOperatingSystemType() == OperatingSystemType.WINDOWS; // Windows env names are case insensitive, so convert the specified name to all-caps before doing the lookup. return getEnvironmentVariables().get((isWindows) ? name.toUpperCase() : name); }