MCPcopy Create free account
hub / github.com/apache/pig / executeJavaCommandAndReturnInfo

Method executeJavaCommandAndReturnInfo

test/org/apache/pig/test/Util.java:1004–1022  ·  view source on GitHub ↗
(String cmd)

Source from the content-addressed store, hash-verified

1002 }
1003
1004 public static ProcessReturnInfo executeJavaCommandAndReturnInfo(String cmd)
1005 throws Exception {
1006 String javaHome = System.getenv("JAVA_HOME");
1007 if(javaHome != null) {
1008 String fileSeparator = System.getProperty("file.separator");
1009 cmd = javaHome + fileSeparator + "bin" + fileSeparator + cmd;
1010 }
1011 Process cmdProc = Runtime.getRuntime().exec(cmd);
1012 ProcessReturnInfo pri = new ProcessReturnInfo();
1013 ReadStream stdoutStream = new ReadStream(cmdProc.getInputStream ());
1014 ReadStream stderrStream = new ReadStream(cmdProc.getErrorStream ());
1015 stdoutStream.start();
1016 stderrStream.start();
1017 cmdProc.waitFor();
1018 pri.exitCode = cmdProc.exitValue();
1019 pri.stdoutContents = stdoutStream.getMessage();
1020 pri.stderrContents = stderrStream.getMessage();
1021 return pri;
1022 }
1023
1024 public static class ProcessReturnInfo {
1025 public int exitCode;

Callers 3

executeJavaCommandMethod · 0.95
validateMethod · 0.95

Calls 4

startMethod · 0.95
getMessageMethod · 0.95
getPropertyMethod · 0.80
execMethod · 0.45

Tested by

no test coverage detected