Sha256: 3d2d8b9a9f666730a3551186be1c7cc34df256283cea07377d0788f381e52bc7
Contents?: true
Size: 689 Bytes
Versions: 4
Compression:
Stored size: 689 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 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 "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
4 entries across 4 versions & 1 rubygems