Skip to content

Instantly share code, notes, and snippets.

@planetsizebrain
Created September 4, 2016 15:10
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 planetsizebrain/fc6307fc7f8e1fea7c6ffd342e9357ca to your computer and use it in GitHub Desktop.
Save planetsizebrain/fc6307fc7f8e1fea7c6ffd342e9357ca to your computer and use it in GitHub Desktop.
A Liferay Groovy script that allows you to execute OS level commands and prints the output
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = 'apt-get --just-print upgrade'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(10000)
println "out>"
println "$sout"
println "err>"
println "$serr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment