An error equivalent for process.text?

groovy

Solution

You can use `waitForProcessOutput` which takes two Appendables (docs here)

def process = "ls -l".execute()
def (output, error) = new StringWriter().with { o -> // For the output
  new StringWriter().with { e ->                     // For the error stream
    process.waitForProcessOutput( o, e )
    [ o, e ]*.toString()                             // Return them both
  }
}
// And print them out...
println "OUT: $output"
println "ERR: $error"

Problem

You can get the entire output stream by using .text: ``` def process = "ls -l".execute() println "Found text ${process.text}" ``` Is there a concise equivalent to get the error stream?

Original source