Class ProcessUtil


  • public class ProcessUtil
    extends Object
    Utility for Process related operations
    • Constructor Detail

      • ProcessUtil

        public ProcessUtil()
    • Method Detail

      • streamOutputToSysOut

        public static void streamOutputToSysOut​(Process process)
        Streams the process' STDOUT to the current process' System.out stream. This creates and starts a thread to stream the contents. The Process is expected to have been started in ProcessBuilder.Redirect.PIPE mode
        Parameters:
        process - The process whose STDOUT needs to be streamed.
      • streamErrorToSysErr

        public static void streamErrorToSysErr​(Process process)
        Streams the process' STDERR to the current process' System.err stream. This creates and starts a thread to stream the contents. The Process is expected to have been started in ProcessBuilder.Redirect.PIPE mode
        Parameters:
        process - The process whose STDERR needs to be streamed.
      • streamErrorTo

        public static void streamErrorTo​(PrintStream printStream,
                                         Process process)
        Streams the process' STDERR to the given printStream. This creates and starts a thread to stream the contents. The Process is expected to have been started in ProcessBuilder.Redirect.PIPE mode
        Parameters:
        process - The process whose STDERR needs to be streamed.