1 package hudson.scm; 2 3 import hudson.EnvVars; 4 import hudson.FilePath; 5 import hudson.Launcher; 6 import hudson.Proc; 7 import hudson.model.BuildListener; 8 import hudson.model.TaskListener; 9 import hudson.util.ArgumentListBuilder; 10 11 import java.io.File ; 12 import java.io.FileWriter ; 13 import java.io.IOException ; 14 import java.io.OutputStream ; 15 import java.util.HashMap ; 16 import java.util.Map ; 17 18 23 abstract class AbstractCVSFamilySCM extends SCM { 24 32 protected final boolean run(Launcher launcher, ArgumentListBuilder cmd, TaskListener listener, FilePath dir, OutputStream out) throws IOException { 33 Map <String ,String > env = createEnvVarMap(true); 34 35 int r = launcher.launch(cmd.toCommandArray(),env,out,dir).join(); 36 if(r!=0) 37 listener.fatalError(getDescriptor().getDisplayName()+" failed. exit code="+r); 38 39 return r==0; 40 } 41 42 protected final boolean run(Launcher launcher, ArgumentListBuilder cmd, TaskListener listener, FilePath dir) throws IOException { 43 return run(launcher,cmd,listener,dir,listener.getLogger()); 44 } 45 46 47 55 protected final Map <String ,String > createEnvVarMap(boolean overrideOnly) { 56 Map <String ,String > env = new HashMap <String ,String >(); 57 if(!overrideOnly) 58 env.putAll(EnvVars.masterEnvVars); 59 buildEnvVars(env); 60 return env; 61 } 62 } 63 | Popular Tags |