views:

141

answers:

3

I'm playing around with Rubygame. I installed it with the Mac Pack, and now I have the rsdl executable. rsdl game.rb works fine, but when I chmod +x the rb file, add the shebang to rsdl (tried direct path and /usr/bin/env rsdl) and try to execute it (./game.rb), it starts to flicker between the Terminal and rsdl which is trying to open, and eventually gives up and gives a bus error. Anyone know what's causing that? I'm on Snow Leopard (10.6.2) if it makes a difference.

Thanks.

A: 

The best place to get an answer would be http://rubygame.org/forums or #rubygame on freenode.

shawn42
A: 

There may be problems with where rsdl expects you to be executing from (i.e. from the executable, rather than a game file). The way i would find out is popping open the rsdl executable (presuming that it's just a ruby script), and poking around inside. I think it'd be useful also to know why you're trying to execute standalone from your ruby script.

knowtheory
A: 

I believe that this is a problem with embedded ruby. Ruby has a horrible hack to handle shebang execution which essentially it looks for "ruby" in the executable name (i.e. argv[0]). If your embedded ruby executable doesn't have "ruby" in its name, this hack fails, and you get an infinite loop (this occurs even with the stock ruby if you rename it). Assuming this is the case here, you can sym-link or mv rsdl to rsdl-ruby (or similar), change your shebang to #!/usr/bin/env rsdl-ruby and it will work.

ergosys