Unbuffer upgrader output by setting $TERM

Also fix a MethodError when the upgrade fails.