Skip to content

Instantly share code, notes, and snippets.

@adampats
Created May 18, 2016 22:25
Show Gist options
  • Save adampats/e682c61fb425a200453607a663980af4 to your computer and use it in GitHub Desktop.
Save adampats/e682c61fb425a200453607a663980af4 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