Skip to content

How to use the sendline() method? #29

@mayhotime

Description

@mayhotime

I edit the example node.js like this:

var nexpect = require('../lib/nexpect');

nexpect.spawn("node")
.expect(">")
.sendline("console.log('testing')")
.expect("testing")
.sendline("process.exit()")
.run(function (err) {
if (!err) {
console.log("node process started, console logged, process exited");
}
else {
console.log(err);
}
});

but the output is nothong!
I don't understanding why use the "node --interactive" instead of "node" ?
and I want to know How to use the nexpect.spawn() method about python?
For example:

var nexpect = require('../lib/nexpect');

nexpect.spawn("python")
.expect("...")
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions