Sha256: 5e57ad7eb918258bfd78ce393e2cbfb80e068d3a8a707efd62d6b707a12815a2
Contents?: true
Size: 824 Bytes
Versions: 10
Compression:
Stored size: 824 Bytes
Contents
require 'open3' module Riiif # Runs shell commands under benchmark and saves the output class CommandRunner include Open3 include ActiveSupport::Benchmarkable delegate :logger, to: :Rails # TODO: this is being loaded into memory. We could make this a stream. # @return [String] all the image data def execute(command) out = nil benchmark("Riiif executed #{command}") do stdin, stdout, stderr, wait_thr = popen3(command) stdin.close stdout.binmode out = stdout.read stdout.close err = stderr.read stderr.close raise ConversionError, "Unable to execute command \"#{command}\"\n#{err}" unless wait_thr.value.success? end out end def self.execute(command) new.execute(command) end end end
Version data entries
10 entries across 10 versions & 2 rubygems