0

I'm trying to kill all ruby processes before starting a new one in a Groovy postbuild script in Jenkins. It looks like that:

def command_kill = "kill -9 `pidof ruby`"
def proc_kill = command_kill.execute()
proc_kill.waitFor()

which results in

KILL: stderr: ERROR: garbage process ID "ruby`".

What's wrong here? This works in the Debian terminal on the same server.

Opal
  • 81,889
  • 28
  • 189
  • 210
Michael Kohler
  • 753
  • 10
  • 22

1 Answers1

0

try this.

def procId = "pidof ruby".execute()
def killProc = "kill ${procId.in.text}".execute()