Skip to content

Commit

Permalink
Merge pull request #9 from skaffolder/master
Browse files Browse the repository at this point in the history
Thanks for your pull request!
  • Loading branch information
luizstacio authored Jun 17, 2018
2 parents 2fe8f23 + 41f03cd commit 25fb57e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ var eventEmitter = require('events').EventEmitter;
var encode = require('./encode');
var readline = require('colors');
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var stream = process.stdin;
var processOut = process.stdout;

Expand Down Expand Up @@ -51,6 +47,10 @@ var Select = function (conf){
this.currentoption = undefined;
this.select = undefined;
this.keypress = this.keypress.bind(this);
this.rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});

for ( var c in conf ) {
this.config[c] = conf[c];
Expand Down Expand Up @@ -232,6 +232,7 @@ Select.prototype.list = function (onSelect) {
* @api private
*/
Select.prototype.close = function () {
this.rl.close();
stream.removeListener('keypress', this.keypress);
processOut.write(encode('[?25h'));
};
Expand Down

0 comments on commit 25fb57e

Please sign in to comment.