rake 路径会产生奇怪的字符并中断`|少`
我正在尝试这样做:
rake routes | less
但它会产生以下奇怪的字符,并破坏less
,使其无法正确搜索或响应。这是新的,已经使用了几年了。我的系统上的某些内容已更改,但我不知道如何停止或更改它!我怎样才能避免这个问题?
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `roles_users`^[[0m
^[[1m^[[35mSQL (0.9ms)^[[0m describe `teams_users`
^[[1m^[[36mSQL (1.0ms)^[[0m ^[[1mdescribe `instructors_media_clips`^[[0m
^[[1m^[[35mSQL (0.7ms)^[[0m describe `collections_packs`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lessons_songs`^[[0m
^[[1m^[[35mSQL (0.9ms)^[[0m describe `media_clips_packs`
^[[1m^[[36mSQL (0.9ms)^[[0m ^[[1mdescribe `instructors_media_clips`^[[0m
^[[1m^[[35mSQL (1.0ms)^[[0m describe `related_media_clips`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lesson_instructors`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `collections_packs`
^[[1m^[[36mSQL (0.6ms)^[[0m ^[[1mdescribe `media_clips_packs`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `roles_users`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lessons_songs`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `teams_users`
admin_admin_main GET /admin/admin/main(.:format) {:controller=>"admin", :action=>"index"}
new_user_session GET /:locale/members/sign_in(.:format) {:controller=>"sessions", :action=>"new"}
user_session POST /:locale/members/sign_in(.:format) {:controller=>"sessions", :action=>"create"}
destroy_user_session GET /:locale/members/sign_out(.:format) {:controller=>"sessions", :action=>"destroy"}
user_password POST /:locale/members/password(.:format) {:controller=>"devise/passwords", :action=>"create"}
new_user_password GET /:locale/members/password/new(.:format) {:controller=>"devise/passwords", :action=>"new"}
edit_user_password GET /:locale/members/password/edit(.:format) {:controller=>"devise/passwords", :action=>"edit"}
PUT /:locale/members/password(.:format) {:controller=>"devise/passwords", :action=>"update"}
cancel_user_registration GET /:locale/members/cancel(.:format) {:controller=>"registrations", :action=>"cancel"}
user_registration POST /:locale/members(.:format) {:controller=>"registrations", :action=>"create"}
new_user_registration GET /:locale/members/sign_up(.:format) {:controller=>"registrations", :action=>"new"}
edit_user_registration GET /:locale/members/edit(.:format) {:controller=>"registrations", :action=>"edit"}
PUT /:locale/members(.:format) {:controller=>"registrations", :action=>"update"}
DELETE /:locale/members(.:format) {:controller=>"registrations", :action=>"destroy"}
profile_users GET /:locale/users/profile(.:format) {:controller=>"users", :action=>"profile"}
users GET /:locale/users(.:format) {:controller=>"users", :action=>"index"}
POST /:locale/users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /:locale/users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /:locale/users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /:locale/users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /:locale/users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /:locale/users/:id(.:format) {:controller=>"users", :action=>"destroy"}
roles GET /:locale/roles(.:format) {:controller=>"roles", :action=>"index"}
POST /:locale/roles(.:format) {:controller=>"roles", :action=>"create"}
I'm trying to do this:
rake routes | less
but it is producing the following weird characters, and breaking less
so that it won't search or respond properly. This is new and used to work for a couple years. Something on my system has changed and I don't know how to stop it or change it! How can I avoid this issue?
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `roles_users`^[[0m
^[[1m^[[35mSQL (0.9ms)^[[0m describe `teams_users`
^[[1m^[[36mSQL (1.0ms)^[[0m ^[[1mdescribe `instructors_media_clips`^[[0m
^[[1m^[[35mSQL (0.7ms)^[[0m describe `collections_packs`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lessons_songs`^[[0m
^[[1m^[[35mSQL (0.9ms)^[[0m describe `media_clips_packs`
^[[1m^[[36mSQL (0.9ms)^[[0m ^[[1mdescribe `instructors_media_clips`^[[0m
^[[1m^[[35mSQL (1.0ms)^[[0m describe `related_media_clips`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lesson_instructors`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `collections_packs`
^[[1m^[[36mSQL (0.6ms)^[[0m ^[[1mdescribe `media_clips_packs`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `roles_users`
^[[1m^[[36mSQL (0.7ms)^[[0m ^[[1mdescribe `lessons_songs`^[[0m
^[[1m^[[35mSQL (0.8ms)^[[0m describe `teams_users`
admin_admin_main GET /admin/admin/main(.:format) {:controller=>"admin", :action=>"index"}
new_user_session GET /:locale/members/sign_in(.:format) {:controller=>"sessions", :action=>"new"}
user_session POST /:locale/members/sign_in(.:format) {:controller=>"sessions", :action=>"create"}
destroy_user_session GET /:locale/members/sign_out(.:format) {:controller=>"sessions", :action=>"destroy"}
user_password POST /:locale/members/password(.:format) {:controller=>"devise/passwords", :action=>"create"}
new_user_password GET /:locale/members/password/new(.:format) {:controller=>"devise/passwords", :action=>"new"}
edit_user_password GET /:locale/members/password/edit(.:format) {:controller=>"devise/passwords", :action=>"edit"}
PUT /:locale/members/password(.:format) {:controller=>"devise/passwords", :action=>"update"}
cancel_user_registration GET /:locale/members/cancel(.:format) {:controller=>"registrations", :action=>"cancel"}
user_registration POST /:locale/members(.:format) {:controller=>"registrations", :action=>"create"}
new_user_registration GET /:locale/members/sign_up(.:format) {:controller=>"registrations", :action=>"new"}
edit_user_registration GET /:locale/members/edit(.:format) {:controller=>"registrations", :action=>"edit"}
PUT /:locale/members(.:format) {:controller=>"registrations", :action=>"update"}
DELETE /:locale/members(.:format) {:controller=>"registrations", :action=>"destroy"}
profile_users GET /:locale/users/profile(.:format) {:controller=>"users", :action=>"profile"}
users GET /:locale/users(.:format) {:controller=>"users", :action=>"index"}
POST /:locale/users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /:locale/users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /:locale/users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /:locale/users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /:locale/users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /:locale/users/:id(.:format) {:controller=>"users", :action=>"destroy"}
roles GET /:locale/roles(.:format) {:controller=>"roles", :action=>"index"}
POST /:locale/roles(.:format) {:controller=>"roles", :action=>"create"}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些看起来像 ANSI 颜色转义序列。就好像 less 没有正确解释序列一样。您确定您没有使用任何更少的选项吗?也许有一些选项,例如
less -R
或less --RAW-CONTROL-CHARS
。我承认我对 ANSI 颜色转义序列了解不多。Those look like ANSI color escape sequences. It's as if less is not interpreting the sequences correctly. You're sure you're not using any options with less? Maybe there's some option like
less -R
orless --RAW-CONTROL-CHARS
. I admit I don't know a whole lot about ANSI color escape sequences.Jared 正确地说您需要使用
less -R
来解释颜色序列。就失去对
less
导航的控制而言,我不认为这是由rake
引起的,而是由 Rails 中尝试从 STDIN 读取的内容引起的。要解决此问题,请重定向 STDIN:
Jared is correct to say you need to use
less -R
to interpret the color sequences.In terms of losing control of
less
's navigation, I don't think it's caused byrake
, but by something in rails trying to read from STDIN.To work around the issue, redirect STDIN: