diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index f95779cbbe6cee6aa096ee73f8118f62cea266f6..326c40973984776cd09470cec259bddc26cb7c02 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -438,24 +438,18 @@ public final class FilePath implements Serializable { * If this file already exists, it will be overwritten. * If the directory doesn't exist, it will be created. */ - public OutputStream write() throws IOException { + public OutputStream write() throws IOException, InterruptedException { if(channel==null) return new FileOutputStream(new File(remote)); - final Pipe p = Pipe.createLocalToRemote(); - channel.callAsync(new Callable() { - public Void call() throws IOException { + return channel.call(new Callable() { + public OutputStream call() throws IOException { File f = new File(remote); f.getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(f); - Util.copyStream(p.getIn(),fos); - fos.close(); - p.getIn().close(); - return null; + return new RemoteOutputStream(fos); } }); - - return p.getOut(); } /**