agave-common/common-core/src/main/java/org/iplantc/service/common/Settings.java
/**
     * Helper to fork commands and return response as a newline
     * delimited list.
     * 
     * @param command
     * @return response broken up by newline characters.
     */
Helper to fork commands and return response as a newline
delimited list.

@param command
@return response broken up by newline characters.
Helper to fork commands and return response as a newline delimited list . @param command @return response broken up by newline characters .
public static List<String> fork(String command) 
    {
        List<String> lines = new ArrayList<String>();
        BufferedReader reader = null;
        String[] cmd = { "sh", "-c", command };
        try {
            Process p = Runtime.getRuntime().exec(cmd);
            p.waitFor();
            reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line = "";
            while ((line = reader.readLine())!= null) {
                lines.add(line);
            }
        }
        catch (IOException | InterruptedException e) {
            log.error("Failed to fork command " + command);
        }
        finally {
            if (reader != null) try {reader.close();} catch (Exception e) {}
        }
        return lines;
    }
public static List < String > fork ( String command ) { List < String > lines = new ArrayList < String > ( ) ; BufferedReader reader = null ; String [ ] cmd = { "sh" , "-c" , command } ; try { Process p = Runtime . getRuntime ( ) . exec ( cmd ) ; p . waitFor ( ) ; reader = new BufferedReader ( new InputStreamReader ( p . getInputStream ( ) ) ) ; String line = "" ; while ( ( line = reader . readLine ( ) ) != null ) { lines . add ( line ) ; } } catch ( IOException | InterruptedException e ) { log . error ( "Failed to fork command " + command ) ; } finally { if ( reader != null ) try { reader . close ( ) ; } catch ( Exception e ) { } } return lines ; }
Helper to fork commands and return response as a newline
 delimited list.
Helper to fork commands and return response as a newline delimited list .