From 865f5d736fa773cb5d1d36318bb50853f3c79abc Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 22 Mar 2007 23:30:06 +0000 Subject: [PATCH] supported creating a launcher for a FilePath. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2573 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/FilePath.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index d2b7031dd2..0bd6483a72 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -8,6 +8,9 @@ import hudson.remoting.VirtualChannel; import hudson.remoting.DelegatingCallable; import hudson.util.IOException2; import hudson.model.Hudson; +import hudson.model.TaskListener; +import hudson.Launcher.LocalLauncher; +import hudson.Launcher.RemoteLauncher; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.Copy; @@ -693,6 +696,17 @@ public final class FilePath implements Serializable { } } + /** + * Creates a {@link Launcher} for starting processes on the node + * that has this path. + */ + public Launcher createLauncher(TaskListener listener) { + if(channel==null) + return new LocalLauncher(listener); + else + return new RemoteLauncher(listener,channel,isUnix()); + } + @Deprecated public String toString() { // to make writing JSPs easily, return local -- GitLab