Skip to content

Instantly share code, notes, and snippets.

@actionjack
Forked from adampats/groovy.groovy
Created October 10, 2018 14:51
Show Gist options
  • Select an option

  • Save actionjack/f5aea1fa12d2e2688e4829d108ceff31 to your computer and use it in GitHub Desktop.

Select an option

Save actionjack/f5aea1fa12d2e2688e4829d108ceff31 to your computer and use it in GitHub Desktop.
Jenkins groovy script to execute shell command
def cmd = 'hostname'
def sout = new StringBuffer(), serr = new StringBuffer()
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println sout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment