Skip to content

Commit

Permalink
Merge branch 'master' into apiv18
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Oct 21, 2016
2 parents 4faced7 + 8b05752 commit ba08efa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/main/java/org/rundeck/client/tool/commands/Jobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,18 @@ public void list(ListOpts options, CommandOutput output) throws IOException {
throw new IllegalStateException("Unexpected response format: " + body.contentType());
}
InputStream inputStream = body.byteStream();
try (FileOutputStream out = new FileOutputStream(options.getFile())) {
long total = Util.copyStream(inputStream, out);
output.output(String.format(
"Wrote %d bytes of %s to file %s%n",
total,
body.contentType(),
options.getFile()
));
if ("-".equals(options.getFile().getName())) {
long total = Util.copyStream(inputStream, System.out);
} else {
try (FileOutputStream out = new FileOutputStream(options.getFile())) {
long total = Util.copyStream(inputStream, out);
output.output(String.format(
"Wrote %d bytes of %s to file %s%n",
total,
body.contentType(),
options.getFile()
));
}
}
} else {
Call<List<JobItem>> listCall;
Expand Down

0 comments on commit ba08efa

Please sign in to comment.