Skip to content

Instantly share code, notes, and snippets.

@cpanato
Created August 11, 2017 13:17
Show Gist options
  • Save cpanato/be258199d193c80f382fa2eb432919ce to your computer and use it in GitHub Desktop.
Save cpanato/be258199d193c80f382fa2eb432919ce to your computer and use it in GitHub Desktop.
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = 'ls /var/jenkins_home/plugins/'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
File file = new File("/var/jenkins_home/plugins/")
println "The file ${file.absolutePath} has ${file.length()} bytes"
proc = 'cp /var/jenkins_home/plugins/bla.hpi /var/jenkins_home/workspace/blablajob'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
println "out> $sout err> $serr"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment