Last active
December 12, 2015 12:19
-
-
Save Sixeight/4771462 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preference-ENGINE:/Users/tomohiro:(---) 2.0.0-rc2 | |
2:16:> irb | |
irb(main):001:0> require 'fiddle' | |
=> true | |
irb(main):002:0> DL | |
NameError: uninitialized constant DL | |
from (irb):2 | |
from /Users/tomohiro/.rbenv/versions/2.0.0-rc2/bin/irb:12:in `<main>' | |
irb(main):003:0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preference-ENGINE:/Users/tomohiro:(---) 2.0.0-rc2 | |
2:18:> irb | |
irb(main):001:0> require 'dl' | |
DL is deprecated, please use Fiddle | |
=> true | |
irb(main):002:0> DL | |
=> DL | |
irb(main):003:0> DL.fiddle? | |
=> true | |
irb(main):004:0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Preference-ENGINE:/Users/tomohiro:(---) 1.9.3-p374 | |
2:18:> irb | |
irb(main):001:0> require 'fiddle' | |
=> true | |
irb(main):002:0> DL | |
=> DL | |
irb(main):003:0> DL.fiddle? | |
=> true | |
irb(main):004:0> |
DL is deprecated, please use Fiddle
oh...
Sorry, it's not convenient, but you need to conditionalize:
diff --git a/lib/spring/sid.rb b/lib/spring/sid.rb
index 632c694..c70e212 100644
--- a/lib/spring/sid.rb
+++ b/lib/spring/sid.rb
@@ -2,8 +2,14 @@ require 'fiddle'
module Spring
module SID
+ if RUBY_VERSION >= '2.0.0'
+ handle = Fiddle::Handle
+ else
+ handle = DL::Handle
+ end
+
FUNC = Fiddle::Function.new(
- DL::Handle::DEFAULT['getsid'],
+ handle::DEFAULT['getsid'],
[Fiddle::TYPE_INT],
Fiddle::TYPE_INT
)
I'll send a patch.
@tenderlove Thank you for your information!
and thank you for your patch for spring!
done: rails/spring#51
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the problem appears in spring.
following code doesn't run with ruby 2.0.
https://github.com/jonleighton/spring/blob/master/lib/spring/sid.rb