From e967c0cdc202de681d367f57df1c1fcaf2cd61d7 Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 15 Feb 2011 09:16:41 -0800 Subject: [PATCH] SlaveComputer.getChannelToMaster() can be null if Launcher is used to connect other VMs than the slaves. So act gracefully --- core/src/main/java/hudson/util/ProcessTree.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/util/ProcessTree.java b/core/src/main/java/hudson/util/ProcessTree.java index 8fbe3dc517..08ceebe063 100644 --- a/core/src/main/java/hudson/util/ProcessTree.java +++ b/core/src/main/java/hudson/util/ProcessTree.java @@ -155,11 +155,18 @@ public abstract class ProcessTree implements Iterable, IProcessTree, /*package*/ final List getKillers() throws InterruptedException { if (killers==null) try { - killers = SlaveComputer.getChannelToMaster().call(new Callable, IOException>() { - public List call() throws IOException { - return new ArrayList(ProcessKiller.all()); - } - }); + VirtualChannel channelToMaster = SlaveComputer.getChannelToMaster(); + if (channelToMaster!=null) { + killers = channelToMaster.call(new Callable, IOException>() { + public List call() throws IOException { + return new ArrayList(ProcessKiller.all()); + } + }); + } else { + // used in an environment that doesn't support talk-back to the master. + // let's do with what we have. + killers = Collections.emptyList(); + } } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to obtain killers",e); killers = Collections.emptyList();