Skip to content

Instantly share code, notes, and snippets.

@nkonev
Last active November 7, 2015 05:19
Show Gist options
  • Select an option

  • Save nkonev/0d22f870a1a2aea18f2c to your computer and use it in GitHub Desktop.

Select an option

Save nkonev/0d22f870a1a2aea18f2c to your computer and use it in GitHub Desktop.
Запуск процесса из groovysh
// http://groovy.codehaus.org/Process+Management
groovysh --terminal=none
["ping.exe", "first with space", "second"].execute().in.text
println "ping".execute().text
p = "ping".execute()
println p.in.text
println p.err.text
// Скобки обязательны
println p.exitValue()
pr = "cmd /c dir".execute()
pr.text
@nkonev
Copy link
Author

nkonev commented Nov 7, 2015

def p = "git tag".execute(Collections.emptyList(), new File("/var/lib/jenkins/workspace/run-tests-no-projects-update-2"))
p.waitFor()
def str = p.in.text // p.err.text
Arrays.asList(str.split("\s+"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment