> + */
> + public static String getWindowsEveryonePrincipalName() {
> + Runtime rt = Runtime.getRuntime();
> + Process pr = null;
> + try {
> + pr = rt.exec("whoami /groups | find \"S-1-1-0\"");
> + } catch (IOException e) {
> + return "Everyone";
> + }
> + try {
> + pr.waitFor();
> + } catch (InterruptedException e) {
> + e.printStackTrace();
> + }
> + try ( InputStreamReader reader = new
> InputStreamReader(pr.getInputStream(), Charsets.UTF_8)) {
> + return CharStreams.toString(reader).split(" ")[0];
Could you simplify this with:
```java
Process process = new ProcessBuilder("whoami /groups").start()
try {
String line;
while ((line = reader.readLine ()) != null) {
if (line.indexOf("\"S-1-1-0\"") != -1) {
return line.split(" ")[0];
}
}
} finally {
process.destroy();
}
```
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/879/files#r45166660