Comments (5)
Hi,
I'm aware of this issue, but there isn't much to do. The lib is not to blame for this, that's the way Node.js deals with stdin that cause this. You should explicitly close the app at the end of the terminate()
function.
You can replace your terminate()
function by:
function terminate() {
term.processExit() ;
}
This will turn grabInput off, perform some cleanup and exit.
term.processExit()
accepts an exit code as argument.
from terminal-kit.
Hi,
Thanks for your answer. You are right that I could do process.exit()
, but that doesn't seem like the best solution.
I'm not sure you're right about the stdin
. but I don't think that's entirely correct. If you look at this readline
example:
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Press enter', (answer) => {
rl.close();
});
It terminates after you press enter. I'm guessing it could be fixed in terminal-kit
by closing the input stream when the user does grabInput(false)
, or am I wrong?
from terminal-kit.
Yes, closing the input stream would terminate the process.
When grab-input is turned off, it only removes the input stream listener. It is possible to turn grab-input on later, so it doesn't make sense to close the stream.
from terminal-kit.
To me it should be possible to do it the same way that readline
does. It feels a little off that after I am done reading input I now have to use process.exit
when I want to, at some point, close the program.
Imagine I'm making a program where I ask the user for something, and at some point my program starts to download a file. Now it becomes scary if I closed the program before the download stream was done.
from terminal-kit.
Well, you should know when your app should be closed or not ;)
Seriously, if at some point this is a problem for you, you may consider using async-kit's async.exit(). That will help you to cleanly exit your app.
Whenever I get some time, I will explore the readline() code source to see if there is some tricks to achieve that cleanly. Closing stdin is not an option.
from terminal-kit.
Related Issues (20)
- Document model - typed? dev branch?
- terminalkit.TextBox is not a constructor HOT 3
- document: InlineInputField only widthPercent breaks input
- Redraw window every "frame" HOT 1
- Word/Line wrap ERROR when x,y,width or height of TextBox are non integers
- Unable to draw the correct image in vscode dark-mode terminal!
- Can't run after packed with pkg HOT 3
- Cannot input after using term.inputField() HOT 4
- Issue: Terminal stuck in while-loop when initating another terminal with stdin/stdout
- Form control event and validation
- form render issue - hide/show control
- Erase Everything - How? HOT 1
- Possible EventEmitter memory leak
- Multiple Documents in Same Terminal Screen
- support for fonts HOT 1
- term.table does not work in Azure pipeline HOT 6
- term.table does not work in Azure pipeline HOT 1
- Unable to bundle code with dependencies HOT 5
- inputField Inline support? HOT 1
- Documentation request: cannot chain .inputField
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 terminal-kit.