Can't use rails_upgrade plugin on Windows due to missing fork() function

I'm on Windows....and I can't get anything to work with this plugin:

If I run rake rails:upgrade:check, for example, I get this:

rake aborted! fork() function is unimplemented on this machine

What a drag! I heard that Ruby's fork() function is unimplemented on Windows... DOES THAT MEAN I CAN'T USE THE PLUGIN?

If you have any insights, please helpppp!

Hi daze,

I’m trying the same without a solution yet. Did you make any progress?

Kind regards Marc

I had the same problem, and found the solution here:

https://github.com/jm/rails_upgrade/issues#issue/7/comment/497475

There's a required gem that uses fork(), of which there is a windows version that doesn't. So first, you have to...

gem install win32-open3

...and then you edit the file as stated in the link, I quote:

edit vendor\plugins\rails_upgrade\lib\application_checker.rb and change: require 'open3' to require 'win32/open3'

Cheers, Guido

In the end, I just made a new rails 3 application and did a lot of code transfer (copy/paste). It actually didn't take that long, and things are great with the app in Rails 3.

I tried using this https://github.com/matschaffer/win32-open3-19 as described in this post: Ruby 1.9 - no such file to load 'win32/open3' - Stack Overflow

But I never got it to work.

Note that the "win32-open3 requires Ruby version < 1.9.0" So I used pik to downgrade to Ruby version 1.8.7, so I could use win32-open3, and then I was able to run the rails_upgrade plugin. Then I plan to upgrade my app using 1.8.7, make sure that works, and get that checked into version control. Once that's done I'll use pik to go back up to 1.9.* and make sure it still works.

Don't forget to add

     gem "win32-open3"

to your Gemfile, at least until you get the rails upgrade done (no need to check that into version control unless you are also checking in the rails upgrade plugin, which you probably won't).