Git Product home page Git Product logo

Comments (1)

jarib avatar jarib commented on July 1, 2024

Your problem is probably that IO#noecho will throw a Errno::ENOTTY if $stdin.tty? is false. So it depends on how you've set up stdin for the child process. For example, hooking it up to the actual terminal works just fine:

code = <<RUBY
  require 'io/console'

  p $stdin.tty?
  p $stdin.noecho(&:gets)
RUBY

proc = ChildProcess.build('ruby', '-e', code)
proc.io.inherit!
proc.start
proc.wait

You may get it working by using a pseudo-terminal (maybe PTY from Ruby's stdlib can be used for this), but I haven't seen it done before. If you figure it out, please share the code!

Another solution would be to change shelly to check if noecho is actually needed/possible:

password = $stdin.tty? ? $stdin.noecho(&:gets) : $stdin.gets

In any case I don't think this is a bug in childprocess. If you still think that's the case, please provide a reduced example that demonstrates the expected/actual behavior.

from childprocess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.