GithubHelp home page GithubHelp logo

Comments (5)

indexzero avatar indexzero commented on June 6, 2024

Probably has to do with how read is interacting with this internally.

from nexpect.

mrmowgli avatar mrmowgli commented on June 6, 2024

Going through the Nexpect code looks like everything should be working...

I'm tempted to say this is actually a node child_process problem, but I'm still digging into getting this example to work using spawn or exec. So far it's leading me to believe that either the bash read is somehow bypassing stdout (perhaps it's on stderr?), bash creates a direct write to the terminal, or Node can't capture certain kinds of output.

from nexpect.

sam-github avatar sam-github commented on June 6, 2024

from man bash, for the read command

              -p prompt
                     Display  prompt on standard error, without a trailing newline, before attempting to
                     read any input.  The prompt is displayed only if input is coming from a terminal.

So, it seems you should not behaviour in nexpect to be same as when run interactively. nexpect would need overhaul to spawn in pseudo-tty, and Node.js doesn't support such capabilities natively, AFAICT.

from nexpect.

mrmowgli avatar mrmowgli commented on June 6, 2024

Ok, that certainly explains it.

I remember reading that there was some tty support, but don't know how to make node operate that way: Node TTY or this one to force tty.

Looks like I will be rewriting some bash scripts in node for now, until I figure this out :)

from nexpect.

sam-github avatar sam-github commented on June 6, 2024

The node APIs, and force tty are the opposite of what you want, you need node to be a pseudo tty master, see:

http://en.wikipedia.org/wiki/Pseudo-TTY

from nexpect.

Related Issues (16)

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.