Browse Source

I've broken output to files that don't exist before running sshexec

master
Stefan Bodewig 5 years ago
parent
commit
8511719cf3
2 changed files with 5 additions and 1 deletions
  1. +2
    -0
      WHATSNEW
  2. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java

+ 2
- 0
WHATSNEW View File

@@ -8,6 +8,8 @@ Fixed bugs:
the stacktrace for failures. This is now fixed.
Bugzilla Report 63827

* sshexec failed to write output to a file if the file didn't exist

Other changes:
--------------



+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java View File

@@ -482,8 +482,10 @@ public class SSHExec extends SSHBase {
*/
private void writeToFile(final String from, final boolean append, final File to)
throws IOException {
final StandardOpenOption appendOrTruncate = append ? StandardOpenOption.APPEND
: StandardOpenOption.TRUNCATE_EXISTING;
try (BufferedWriter out = Files.newBufferedWriter(to.getAbsoluteFile().toPath(),
StandardOpenOption.APPEND)) {
appendOrTruncate, StandardOpenOption.CREATE)) {
final StringReader in = new StringReader(from);
final char[] buffer = new char[BUFFER_SIZE];
while (true) {


Loading…
Cancel
Save