diff options
Diffstat (limited to 'activestorage/lib/active_storage/previewer.rb')
-rw-r--r-- | activestorage/lib/active_storage/previewer.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activestorage/lib/active_storage/previewer.rb b/activestorage/lib/active_storage/previewer.rb index 3d485988e9..dacab1e7df 100644 --- a/activestorage/lib/active_storage/previewer.rb +++ b/activestorage/lib/active_storage/previewer.rb @@ -42,20 +42,22 @@ module ActiveStorage # end # # The output tempfile is opened in the directory returned by ActiveStorage::Downloading#tempdir. - def draw(*argv) # :doc: - Tempfile.open("ActiveStorage", tempdir) do |file| - capture(*argv, to: file) - yield file + def draw(*argv) #:doc: + ActiveSupport::Notifications.instrument("preview.active_storage") do + Tempfile.open("ActiveStorage", tempdir) do |file| + capture(*argv, to: file) + yield file + end end end def capture(*argv, to:) to.binmode - IO.popen(argv) { |out| IO.copy_stream(out, to) } + IO.popen(argv, err: File::NULL) { |out| IO.copy_stream(out, to) } to.rewind end - def logger + def logger #:doc: ActiveStorage.logger end end |