Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masanobuimai/619231 to your computer and use it in GitHub Desktop.
Save masanobuimai/619231 to your computer and use it in GitHub Desktop.
// g100pon #76 外部コマンドの起動と出力の取得等
def COMMAND = "ls -l ."
// def COMMAND = "cmd /c dir" // Windowsだったらこう?
// 外部コマンドの実行
def p = COMMAND.execute()
p.waitFor() // 終了まで待機
println p.exitValue() // 終了コード
// 外部コマンドの出力を取得
println p.text // 標準出力(または p.in.text)
println p.err.text // 標準エラー出力
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment