4
4

More than 5 years have passed since last update.

Ruby | Cygwin + Bundler 1.7.4 で rake build / rake install が止まってしまうケースへの対応

Posted at

Ruby | Cygwin + Bundler 1.7.4 で rake build / rake install が止まってしまうケースへの対応

経緯

いつからか・何が原因か分かりませんが、Cygwin + Bundler 1.7.4 で rake build / rake install を実行した
直後にコマンドラインが実行したままになって、いつまでたっても処理が終了しなくなりました。
プロセスを強制終了し、出力された gem を確認したり、 gem のインストール結果を確認すると
処理は正常に終了しているようです。

もし同じ症状の人がいたら役に立つかもしれないので情報を残します。

前提環境

  • Windows 7
  • Cygwin(64bit)
  • rbenv
  • Ruby 2.1
  • Bundler 1.7.4
  • gem 2.4.1

対応

原因調査のため bundler の rake task の本体である、
gem helper の初期化処理に puts を仕込みました。

  • Bundler::GemHelper#initialize のコード

  • 修正コード
def initialize(base = nil, name = nil)
  puts
  Bundler.ui = UI::Shell.new
  @base = (base ||= SharedHelpers.pwd)
  gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
  raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
  @spec_path = gemspecs.first
  @gemspec = Bundler.load_gemspec(@spec_path)
end

すると・・・なぜかエラーが発生しなくなりました。
(print だと直らない)
原因は分からないままですが、応急処置として何も出力しない puts を追加することにしました。

4
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4