Skip to content

Commit

Permalink
Print progress messages to stderr when printing JSON
Browse files Browse the repository at this point in the history
This avoids the messages breaking JSON parsing when
the output is being redirected to a file and parsed.
  • Loading branch information
pabs3 committed May 3, 2021
1 parent ea15965 commit 06e2595
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/wayback_machine_downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ def get_file_list_by_timestamp

def list_files
# retrieval produces its own output
@orig_stdout = $stdout
$stdout = $stderr
files = get_file_list_by_timestamp
$stdout = @orig_stdout
puts "["
files.each do |file|
puts file.to_json + ","
Expand Down

0 comments on commit 06e2595

Please sign in to comment.