Skip to content

Commit

Permalink
Fix JRUBY-4962: "require 'pty'" fails with LoadError: no library spec…
Browse files Browse the repository at this point in the history
…ified

with a little help from Wayne Meissner.
  • Loading branch information
BanzaiMan committed Jul 22, 2010
1 parent 71b2a40 commit ad0afa7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ruby/site_ruby/shared/pty.rb
Expand Up @@ -4,6 +4,7 @@ module PTY
private private
module LibUtil module LibUtil
extend FFI::Library extend FFI::Library
ffi_lib FFI::Library::LIBC
# forkpty(3) is in libutil on linux, libc on MacOS/BSD # forkpty(3) is in libutil on linux, libc on MacOS/BSD
if FFI::Platform.linux? if FFI::Platform.linux?
ffi_lib 'libutil' ffi_lib 'libutil'
Expand All @@ -12,6 +13,7 @@ module LibUtil
end end
module LibC module LibC
extend FFI::Library extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :close, [ :int ], :int attach_function :close, [ :int ], :int
attach_function :strerror, [ :int ], :string attach_function :strerror, [ :int ], :string
attach_function :execv, [ :string, :buffer_in ], :int attach_function :execv, [ :string, :buffer_in ], :int
Expand Down
8 changes: 8 additions & 0 deletions test/test_pty.rb
@@ -0,0 +1,8 @@
require 'test/unit'

class LoadPtyTest < Test::Unit::TestCase
# JRUBY-4962
def test_require_pty
assert_nothing_raised { require 'pty' }
end
end

0 comments on commit ad0afa7

Please sign in to comment.