Source:
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener) throws InterruptedException { this.build = build; FilePath ws = build.getWorkspace(); if (ws == null) { Node node = build.getBuiltOn(); if (node == null) { throw new NullPointerException("no such build node: " + build.getBuiltOnStr()); } throw new NullPointerException("no workspace from node " + node + " which is computer " + node.toComputer() + " and has channel " + node.getChannel()); } FilePath script=null; int r = -1; try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); return false; } try { EnvVars envVars = build.getEnvironment(listener); for(Map.Entry<String,String> e : build.getBuildVariables().entrySet()) envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed())); } this.build = null; return r==0; } finally { try { if(script!=null) script.delete(); } catch (IOException e) { if (r==-1 && e.getCause() instanceof ChannelClosedException) { LOGGER.log(Level.FINE, "Script deletion failed", e); } else { Util.displayIOException(e,listener); e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } catch (Exception e) { e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } }

Target:
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, TaskListener listener) throws InterruptedException { FilePath ws = build.getWorkspace(); if (ws == null) { Node node = build.getBuiltOn(); if (node == null) { throw new NullPointerException("no such build node: " + build.getBuiltOnStr()); } throw new NullPointerException("no workspace from node " + node + " which is computer " + node.toComputer() + " and has channel " + node.getChannel()); } FilePath script=null; int r = -1; try { try { script = createScriptFile(ws); } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_UnableToProduceScript())); return false; } try { EnvVars envVars = build.getEnvironment(listener); for(Map.Entry<String,String> e : build.getBuildVariables().entrySet()) envVars.put(e.getKey(),e.getValue()); r = join(launcher.launch().cmds(buildCommandLine(script)).envs(envVars).stdout(listener).pwd(ws).start()); if(isErrorlevelForUnstableBuild(r)) { build.setResult(Result.UNSTABLE); r = 0; } } catch (IOException e) { Util.displayIOException(e, listener); e.printStackTrace(listener.fatalError(Messages.CommandInterpreter_CommandFailed())); } return r==0; } finally { try { if(script!=null) script.delete(); } catch (IOException e) { if (r==-1 && e.getCause() instanceof ChannelClosedException) { LOGGER.log(Level.FINE, "Script deletion failed", e); } else { Util.displayIOException(e,listener); e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } catch (Exception e) { e.printStackTrace( listener.fatalError(Messages.CommandInterpreter_UnableToDelete(script)) ); } } }