How can you suppress the output of db:load:schema? Running
bundle exec rake db:schema:load
with the -s
, -q
, or ev
Here is a cleaner solution that works cross-system:
silence_stream(STDOUT) do
# anything written to STDOUT here will be silenced
Rake::Task["db:schema:load"].invoke
end
also
quietly do
# anything written to STDOUT or STDERR here will be silenced
Rake::Task["db:schema:load"].invoke
end
I prefer silence_stream(STDOUT)
toquietly
because it will still allow error messages written to STDERR
to be shown, which will be helpful when the rake command starts to act up.
References: silence_stream, silence_warnings, & quietly