
def process = "ls -l".execute()println "Found text ${process.text}" 是否有一个简洁的等价物来获取错误流?
解决方法 你可以使用waitForProcessOutput,它有两个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" 总结 以上是内存溢出为你收集整理的groovy – process.text的错误等价物?全部内容,希望文章能够帮你解决groovy – process.text的错误等价物?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)