Browse Source

resume stdin only when reading email

master
nkzawa 9 years ago
parent
commit
063110008b
  1. 8
      lib/login.js

8
lib/login.js

@ -3,15 +3,13 @@ import fetch from 'node-fetch';
import * as cfg from './cfg';
import { stringify as stringifyQuery } from 'querystring';
const stdin = process.openStdin();
function readEmail () {
return new Promise((resolve, reject) => {
process.stdout.write('> Enter your email address: ');
stdin.on('data', (d) => {
stdin.destroy();
process.stdin.on('data', (d) => {
process.stdin.pause();
resolve(d.toString().trim());
});
}).resume();
});
}

Loading…
Cancel
Save