Rails: Clean rails command line backtrace-dump

From FVue
Jump to: navigation, search

When the rails command returns an error, it is followed by many lines of framework backtrace which causes the main error to scroll of screen. How can I get rid of this framework backtrace?

Solution: Bash stderr filter

The command below will clear the error output from all lines containing "from /home" which effectively removes all backtrace lines referring to library gems located in my /home/USER/.rvm/gems directory.

rails s -p3005 3>&1 1>&2 2>&3 3>&- | grep -v 'from \/home'

See: https://stackoverflow.com/questions/3618078/pipe-only-stderr-through-a-filter