PTY gem not found

前端 未结 3 1035
野性不改
野性不改 2021-01-19 00:35

I have Ruby 1.9.3 installed on windows. When I try to require the gem the console outputs that the gem was not found:

require \'pty\'

Which

3条回答
  •  梦谈多话
    2021-01-19 01:29

    You can try

    gem install rubysl-pty
    

    if target ruby version is 1.9.x, run gem command with appropriate -v option

    gem install rubysl-pty -v 1.0.0
    

    if you would like to use PTY on Windows, my best recommendation is to use cygwin. I am able to install and use this rubysl-pty on my Windows with cygwin yet with few limitations:

    $ gem install rubysl-pty -v 1.0.0
    Building native extensions.  This could take a while...
    Successfully installed rubysl-pty-1.0.0
    1 gem installed
    Installing ri documentation for rubysl-pty-1.0.0...
    Installing RDoc documentation for rubysl-pty-1.0.0...
    

    Sample code:

    # test.rb
    require 'pty'
    PTY.getpty("ls") { |i,o,pid| p i; p pid }
    

    Output:

    $ ruby test.rb
    #
    16376
    

提交回复
热议问题