Comments (3)
nexpect returns the spawned child process, I can't recall exactly from which method, but look at https://github.com/nodejitsu/nexpect/blob/master/lib/nexpect.js#L298. That process supports a .kill() method.
from nexpect.
The following works for me:
const {pid} = spawn('cat') // This won’t end by itself.
.expect(/* … */)
;
process.kill(pid); // So let’s kill it!
from nexpect.
Is there a control character I could send through .sendline() to get the same effect as ctrl+c?
I don’t think it’s possible – Ctrl + C
sends the SIGINT signal and not a control character. I’ve just learned that on Stack Exchange.
But you can achieve the same as Ctrl + D
(end of file/input) with nexpect’s .sendEof()
.
from nexpect.
Related Issues (16)
- nexpect - CLI hangs HOT 5
- The version in the public registry is out of date HOT 1
- Pulled from git, all tests fail. HOT 2
- Doesn't work with bash shells? HOT 5
- Regular expression not supported? HOT 1
- Difference between expect() and wait()? HOT 1
- run() got executed twice? HOT 2
- No color in child output
- Support for interactive programs HOT 7
- Is there any OR possibility? HOT 1
- How to use the sendline() method?
- stdout / stderr should be made available to caller in case of error
- `wait` should accept an optional timeout
- Bug: Improper pathname parsing in `nspawn` function HOT 1
- Is it possible to run with Jest?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nexpect.