Skip to content

Commit

Permalink
Merge pull request #251 from slide/remoting_fix
Browse files Browse the repository at this point in the history
Fix issue with TeeStep and remoting
  • Loading branch information
rsandell authored Jun 24, 2024
2 parents 73c3b8f + 54b238d commit 12a1522
Showing 1 changed file with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,27 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound

}

private static final class CreateRemoteStreamCallable extends MasterToSlaveFileCallable<OutputStream> {
private static final long serialVersionUID = 1L;

@Override
public OutputStream invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f = f.getAbsoluteFile();
if (!f.getParentFile().exists() && !f.getParentFile().mkdirs()) {
throw new IOException("Failed to create directory " + f.getParentFile());
}
try {
return new RemoteOutputStream(Files.newOutputStream(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND/*, StandardOpenOption.DSYNC*/));
} catch (InvalidPathException e) {
throw new IOException(e);
}
}
}

/** @see FilePath#write() */
private static OutputStream append(FilePath fp, OutputStream stream) throws IOException, InterruptedException {
if (stream == null) {
return fp.act(new MasterToSlaveFileCallable<OutputStream>() {
private static final long serialVersionUID = 1L;
@Override
public OutputStream invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f = f.getAbsoluteFile();
if (!f.getParentFile().exists() && !f.getParentFile().mkdirs()) {
throw new IOException("Failed to create directory " + f.getParentFile());
}
try {
return new RemoteOutputStream(Files.newOutputStream(f.toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND/*, StandardOpenOption.DSYNC*/));
} catch (InvalidPathException e) {
throw new IOException(e);
}
}
});
return fp.act(new CreateRemoteStreamCallable());
}
return stream;
}
Expand Down

0 comments on commit 12a1522

Please sign in to comment.