提交 50124db9 编写于 作者: J Jesse Glick

Merge branch 'Computer.currentComputer-JENKINS-2786'

......@@ -1313,11 +1313,11 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
* Gets the current {@link Computer} that the build is running.
* This method only works when called during a build, such as by
* {@link hudson.tasks.Publisher}, {@link hudson.tasks.BuildWrapper}, etc.
* @return the {@link Computer} associated with {@link Executor#currentExecutor}, or null if not on an executor thread
*/
public static Computer currentComputer() {
public static @Nullable Computer currentComputer() {
Executor e = Executor.currentExecutor();
// If no executor then must be on master node
return e != null ? e.getOwner() : Jenkins.getInstance().toComputer();
return e != null ? e.getOwner() : null;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册