truffleruby icon indicating copy to clipboard operation
truffleruby copied to clipboard

pty is missing in the standard library

Open deepj opened this issue 6 years ago • 8 comments

See https://ruby-doc.org/stdlib-2.0.0/libdoc/pty/rdoc/PTY.html

To reproduce:

require 'pty'

Error:

LoadError: cannot load such file -- pty
	from ~/.rubies/truffleruby-1.0.0-rc12/lib/mri/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
	from ~/.rubies/truffleruby-1.0.0-rc12/lib/mri/rubygems/core_ext/kernel_require.rb:55:in `require'
	from (irb):1
	from ~/.rubies/truffleruby-1.0.0-rc12/bin/irb:29:in `<main>'

This gem is used in querly tests

deepj avatar Feb 23 '19 10:02 deepj

I'm just working on updating our documentation on standard libraries.

Standard libraries

The following standard libraries are unsupported.

  • continuation
  • dbm
  • gdbm
  • sdbm
  • io/console (partially implemented, could be implemented in the future)
  • io/nonblock (could be implemented in the future)
  • io/wait (partially implemented, could be implemented in the future)
  • pty (could be implemented in the future)
  • ripper (could be implemented in the future)
  • win32
  • win32ole

fiddle is not yet implemented - the module and some methods are there but not enough to run anything serious.

We provide our own included implementation of the interface of the ffi gem, like JRuby and Rubinius, but the implemention of this is limited at the moment.

EDIT: See https://github.com/oracle/truffleruby/blob/master/doc/user/compatibility.md#standard-libraries for up-to-date info.

chrisseaton avatar Feb 23 '19 14:02 chrisseaton

pty is used by the tests of the debug gem: https://github.com/ruby/debug/blob/d0a3372a864d3906ac2a81907b9222dba15883be/test/support/utils.rb#L3

It would be worth trying if importing the pty sources from CRuby works.

eregon avatar Aug 21 '21 21:08 eregon

@bjfish Could you try that?

eregon avatar Aug 22 '21 11:08 eregon

also causes an issue with the appsignal apm

matthewford avatar Nov 17 '22 23:11 matthewford

wicked_pdf gem also use pty

matthewford avatar Nov 17 '22 23:11 matthewford

I have a PR partially done to add pty - will take a look at it again. It's also needed to run the debug gem tests.

chrisseaton avatar Nov 18 '22 00:11 chrisseaton

JRuby recently used libfixposix to get pty working in https://github.com/jruby/jruby/issues/6552, possibly relevant for us, as from reading that issue posix_spawn doesn't have that ability. But we could probably also do it in https://github.com/oracle/truffleruby/blob/master/src/main/c/spawn-helper/spawn-helper.c and that would be simpler/more direct.

eregon avatar Nov 18 '22 11:11 eregon

As a note, using the pty extension won't work because that relies on fork()

eregon avatar Mar 17 '23 17:03 eregon