workaround dev/tty bugs

This commit is contained in:
AJ ONeal 2018-06-24 02:53:29 -06:00
parent c55a348e4a
commit 68ed91a5c9
1 changed files with 12 additions and 1 deletions

View File

@ -102,6 +102,7 @@ function askForConfig(answers, mainCb) {
// https://github.com/nodejs/node/issues/21319 // https://github.com/nodejs/node/issues/21319
, terminal: !useTty , terminal: !useTty
}); });
answers._useTty = useTty;
// NOTE: Use of setTimeout // NOTE: Use of setTimeout
// We're using setTimeout just to make the user experience a little // We're using setTimeout just to make the user experience a little
@ -319,8 +320,9 @@ function askForConfig(answers, mainCb) {
var q = nextSet.shift(); var q = nextSet.shift();
if (!q) { if (!q) {
// https://github.com/nodejs/node/issues/21319 // https://github.com/nodejs/node/issues/21319
if (useTty) { stdin.push(null); }
rl.close(); rl.close();
if (useTty) { stdin.push(null); /*stdin.close();*/ } if (useTty) { try { stdin.close(); } catch(e) { /*ignore*/ } }
mainCb(null, answers); mainCb(null, answers);
return; return;
} }
@ -473,6 +475,15 @@ function parseConfig(err, text) {
// need just a little time to let the grants occur // need just a little time to let the grants occur
setTimeout(function () { setTimeout(function () {
utils.putConfig('list', []); utils.putConfig('list', []);
// workaround for https://github.com/nodejs/node/issues/21319
if (answers._useTty) {
setTimeout(function () {
process.exit(0);
}, 2 * 1000);
}
// end workaround
}, 1 * 1000); }, 1 * 1000);
}); });
}); });