# File lib/mini_magick.rb, line 143 def run_command(command, *args) args.collect! do |arg| # args can contain characters like '>' so we must escape them, but don't quote switches if arg !~ /^\+|\-/ "\"#{arg}\"" else arg.to_s end end command = "#{command} #{args.join(' ')}" output = `#{command} 2>&1` if $?.exitstatus != 0 raise MiniMagickError, "ImageMagick command (#{command.inspect}) failed: #{{:status_code => $?, :output => output}.inspect}" else output end end