Skip to content

Instantly share code, notes, and snippets.

@h1romas4
Created February 24, 2017 03:20
Show Gist options
  • Save h1romas4/acc883f2a1b6057e92246f8156ad7cf1 to your computer and use it in GitHub Desktop.
Save h1romas4/acc883f2a1b6057e92246f8156ad7cf1 to your computer and use it in GitHub Desktop.
コマンドを実行し、標準・エラー出力を行いながらリターンコードを取得
def builder = new ProcessBuilder("ls -laF".split("[\\s]+"))
def process = builder.redirectErrorStream(true).start()
process.inputStream.eachLine { println it }
process.waitFor()
println process.exitValue()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment