Skip to content

Commit 06e2595

Browse files
committed
Print progress messages to stderr when printing JSON
This avoids the messages breaking JSON parsing when the output is being redirected to a file and parsed.
1 parent ea15965 commit 06e2595

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/wayback_machine_downloader.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ def get_file_list_by_timestamp
172172

173173
def list_files
174174
# retrieval produces its own output
175+
@orig_stdout = $stdout
176+
$stdout = $stderr
175177
files = get_file_list_by_timestamp
178+
$stdout = @orig_stdout
176179
puts "["
177180
files.each do |file|
178181
puts file.to_json + ","

0 commit comments

Comments
 (0)