Skip to content

Instantly share code, notes, and snippets.

@goz
Created March 24, 2010 22:45
Show Gist options
  • Save goz/342915 to your computer and use it in GitHub Desktop.
Save goz/342915 to your computer and use it in GitHub Desktop.
def run cmd, params = "", expected_outcodes = 0
command = %Q[#{path_for_command(cmd)} #{params}] # remove this => .gsub(/\s+/, " ")
command = "#{command} 2>#{bit_bucket}" if Paperclip.options[:swallow_stderr]
Paperclip.log(command) if Paperclip.options[:log_command]
output = `#{command}`
unless [expected_outcodes].flatten.include?($?.exitstatus)
raise PaperclipCommandLineError, "Error while running #{cmd}"
end
output
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment