diff --git a/src/main/java/org/rundeck/client/tool/commands/Jobs.java b/src/main/java/org/rundeck/client/tool/commands/Jobs.java index d3830d1b..1592806f 100644 --- a/src/main/java/org/rundeck/client/tool/commands/Jobs.java +++ b/src/main/java/org/rundeck/client/tool/commands/Jobs.java @@ -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> listCall;