mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
SlaveComputer.getChannelToMaster() can be null if Launcher is used to connect other VMs than the slaves.
So act gracefully
This commit is contained in:
1 parent
96dd84b5d0
commit
e967c0cdc2
1 file changed
+12
-5
@@ -155,11 +155,18 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
|
||||
/*package*/ final List<ProcessKiller> getKillers() throws InterruptedException {
|
||||
if (killers==null)
|
||||
try {
|
||||
killers = SlaveComputer.getChannelToMaster().call(new Callable<List<ProcessKiller>, IOException>() {
|
||||
public List<ProcessKiller> call() throws IOException {
|
||||
return new ArrayList<ProcessKiller>(ProcessKiller.all());
|
||||
}
|
||||
});
|
||||
VirtualChannel channelToMaster = SlaveComputer.getChannelToMaster();
|
||||
if (channelToMaster!=null) {
|
||||
killers = channelToMaster.call(new Callable<List<ProcessKiller>, IOException>() {
|
||||
public List<ProcessKiller> call() throws IOException {
|
||||
return new ArrayList<ProcessKiller>(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();
|
||||
|
||||
Reference in new issue
Block a user