Skip to content

Commit

Permalink
revert readline var
Browse files Browse the repository at this point in the history
  • Loading branch information
lujiajing1126 committed Jan 7, 2019
1 parent 22a81d9 commit 483a1ab
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ class RedisClient {
}

attachEvent() {
this.rl = readline.createInterface(process.stdin, process.stdout);
const rl = readline.createInterface(process.stdin, process.stdout);
this._redis_client.on('ready', () => {
if (this.mode !== "UNIXSOCKET") {
this.rl.setPrompt(`${this._host}:${this._port}> `);
rl.setPrompt(`${this._host}:${this._port}> `);
} else {
this.rl.setPrompt(`${this._host}> `);
rl.setPrompt(`${this._host}> `);
}
this.rl.prompt();
rl.prompt();

this.rl.on('line', async (line) => {
rl.on('line', async (line) => {
line = new InputBuffer(line).toString();
try {
let command = line.trim();
Expand All @@ -100,13 +100,13 @@ class RedisClient {
readline.clearScreenDown(process.stdout);
} else {
this.execute([CMD, ...commands]).finally(() => {
this.rl.prompt();
rl.prompt();
});
}
}
} catch (err) {
console.log(colors.red(`(error) ${err.message}`));
this.rl.prompt();
rl.prompt();
}
}).on('close', () => {
console.log('\nAbort!');
Expand Down

0 comments on commit 483a1ab

Please sign in to comment.