Created
April 6, 2013 19:12
-
-
Save TheNotary/5327254 to your computer and use it in GitHub Desktop.
plugins/com.aptana.editor.ruby/src/org/eclipse/ui/texteditor/MyGemFunctions.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getGemsDirectory() | |
{ | |
try | |
{ | |
Process proc = Runtime.getRuntime().exec("which ruby"); | |
BufferedReader stdInput = new BufferedReader(new | |
InputStreamReader(proc.getInputStream())); | |
BufferedReader stdError = new BufferedReader(new | |
InputStreamReader(proc.getErrorStream())); | |
String s; | |
String commandOutput = ""; | |
// read the output from the command | |
System.out.println("Here is the standard output of the command:\n"); | |
while ((s = stdInput.readLine()) != null) { | |
//System.out.println(s); | |
commandOutput += s; | |
} | |
// read any errors from the attempted command | |
System.out.println("Here is the standard error of the command (if any):\n"); | |
while ((String s = stdError.readLine()) != null) { | |
//System.out.println(s); | |
commandOutput += s; | |
} | |
int statusCode = proc.exitValue(); | |
return commandOutput; | |
} | |
catch (IOException e) | |
{ | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
return ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment