Skip to content

Instantly share code, notes, and snippets.

@rameshz23
Forked from adampats/groovy.groovy
Created June 14, 2018 04:31
Show Gist options
  • Save rameshz23/15b70f2ce5bb098602f510450a86a95f to your computer and use it in GitHub Desktop.
Save rameshz23/15b70f2ce5bb098602f510450a86a95f 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