How to get irb and rails console to work properly in gitbash?

倾然丶 夕夏残阳落幕 提交于 2019-12-05 13:36:34

The git bash terminal emulator (mintty) does not really get along with windows console programs. So you might want to look for a wrapper that runs a console program (e.g. irb.cmd, python.exe, etc) then interfaces with the git bash.

Concretely, once you have wintpy.exe and irb in your $PATH of the git bash, you can set an alias as such

$ alias irb='winpty "$(which irb).cmd"'

NOTE that there are two irbs shipped with the default ruby windows installer: a good old bash script irb and a windows batch script irb.cmd. Only the latter works for me with the winpty trick.

Many Thanks to krim! After learning the add-.cmd-trick, I tried the same for rails console bin/rails c) and ended with a ~/scripts/rails_ bash script:

#!/usr/bin/bash
winpty rails.bat "$@"

So I can do now rails_ c or rails_ db etc.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!