Joshua Muheim
Joshua Muheim

Reputation: 13243

Running `system 'rake'` from within a Ruby gem: how to suppress the console output?

I have to run a system "rake assets:precompile" from within a Ruby gem.

How can I prevent it from outputting anything to the console? At the moment it's outputting the following:

I, [2014-01-19T14:11:19.599828 #76714]  INFO -- : Writing /Users/josh/Documents/Work/MuheimWebdesign/transition/public/assets/application-90b828df450eb4e5dd0b88931da42ead.js
I, [2014-01-19T14:11:19.929472 #76714]  INFO -- : Writing /Users/josh/Documents/Work/MuheimWebdesign/transition/public/assets/application-b1bed1c63f05b07c72f1ac7e31b65551.css

Upvotes: 1

Views: 62

Answers (1)

Agis
Agis

Reputation: 33656

You can redirect the output to a place nothing ever happens:

system "rake assets:precompile &> /dev/null"

Upvotes: 2

Related Questions