mendicant-original / community

Mendicant University's community website
community.mendicantuniversity.org
20 stars 10 forks source link

rake setup, EDITOR=vi and backticks #53

Closed wicz closed 12 years ago

wicz commented 12 years ago

When your $EDITOR is vi and you run bundle exec rake setup you get the following error: Vim: Warning: Output is not to a terminal.

I don't know why exactly this happen, maybe because vi expects STDOUT and backticks somehow changes it to read and return it from the subshell after execution (!?)

Some solutions:

Feel free to assign me this issue when we decide the best solution.

jordanbyron commented 12 years ago

How about we do something like:

system(ENV['EDITOR'], file) unless ENV['EDITOR'].blank?

I just don't want the setup to catastrophically fail if the EDITOR variable isn't set.

wicz commented 12 years ago

Sounds good to me.

BTW, any special reason to use unless/blank? instead of if ENV['EDITOR']

jordanbyron commented 12 years ago

BTW, any special reason to use unless/blank? instead of if ENV['EDITOR']

Special reason? Not really. I just like the way it reads: "Do this unless this thing is blank". Plus I don't know how the ENV constant works and if ENV['EDITOR'] returns nil or "" if it isn't set. Calling .blank? covers us either way.

wicz commented 12 years ago

You're right, just test it. if ENV['EDITOR'] will eval to true even if EDITOR is blank.

I'll fix this in a minute.