Hi Bryan Perhaps copy has already been defined in top level and it do something important? Try rename your method to something else and try again.
Francis Chong Ignition Soft On 4 Jul, 2013, at 7:17 AM, bryan rasmussen <rasmussen.br...@gmail.com> wrote: >> I think osx doesnt like the "localhost", try 127.0.0.1. Also, if you know a >> bit of Objc, try the same code there to see if it's a MacRuby only issue. >> > I tried, didn't have any effect. Anyway the salient aspect seems to be > that the code is being called from within a function, otherwise it > works fine - and again the actual post and such works fine - I receive > it on the server no problems. The segmentation fault seems to happen > after it returns, and it only happens when inside of a function, as in > examples I sent earlier. > > So to reiterate, this: > > def copy() > uri = URI('http://127.0.0.1:3000/api/copy/test') > Net::HTTP.post_form(uri, 'value' => "testing") > > > end > > copy() > > causes segmentation fault 11 > > this > > uri = URI('http://127.0.0.1:3000/api/copy/test') > Net::HTTP.post_form(uri, 'value' => "testing") > > works fine. > > Since this is absolutely ridiculous on its face I would expect I am > doing something wrong that is so simple that it is just slipping by > unnoticed, either that or a common newbie error. > I also thought it could be related to this stuff: > http://www.seqmedia.com/2012/05/08/frustrations-abound-rvm-vs-macports-and-the-bug-segmentation-fault/ > > but not exactly since I am using macruby directly, I shouldn't be > using openssl anywhere in that code, and this doesn't really explain > why it only fails when called inside a function (but after the post to > the server completes) > > Thanks, > Bryan Rasmussen > >>> On 03/07/2013, at 13:17, bryan rasmussen <rasmussen.br...@gmail.com> wrote: >>> >>> Hi, >>> >>> I have the following: >>> >>> require 'net/http' >>> >>> def copy() >>> uri = URI('http://localhost:3000/api/copy/test') >>> Net::HTTP.post_form(uri, 'value' => "testing") >>> >>> >>> end >>> >>> copy() >>> >>> >>> When I run that code with macruby myscript.rb >>> I get segmentation fault 11, >>> When I run this code >>> >>> require 'net/http' >>> >>> uri = URI('http://localhost:3000/api/copy/test') >>> Net::HTTP.post_form(uri, 'value' => "testing") >>> >>> I don't. >>> >>> The post goes through fine in both instances. I suppose there has to >>> be some really simple thing I am missing here? >>> >>> Thanks, >>> Bryan Rasmussen >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> https://lists.macosforge.org/mailman/listinfo/macruby-devel >> >> >> ------------------------------ >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> https://lists.macosforge.org/mailman/listinfo/macruby-devel >> >> >> End of MacRuby-devel Digest, Vol 64, Issue 1 >> ******************************************** > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > https://lists.macosforge.org/mailman/listinfo/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macruby-devel