now removing readline correcctly

This commit is contained in:
2016-06-11 23:47:52 +02:00
parent 24cce5d9b2
commit 03dfdda812
9 changed files with 45 additions and 9 deletions

View File

@ -47,4 +47,5 @@ process.on('SIGINT', () => {
logEarlyAbort = true;
rl.write(null, {ctrl: true, name: 'u'});
rl.close();
process.exit(0);
});

View File

@ -1,6 +1,7 @@
import "typings-global"
import colors = require("colors");
import path = require("path");
let q = require("q");
import readline = require("readline");
import childProcess = require("child_process");
let earlyChild;
@ -30,6 +31,7 @@ export let start = function(moduleNameArg:string = "",loaderLengthArg:string = "
export let stop = function(){
if(doAnimation){
let done = q.defer();
earlyChild.kill();
let rl = readline.createInterface({
input: process.stdin,
@ -37,6 +39,16 @@ export let stop = function(){
});
rl.write(null, {ctrl: true, name: 'u'});
rl.close();
earlyChild.on("close",function(){
let rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.write(null, {ctrl: true, name: 'u'});
rl.close();
done.resolve();
})
return done.promise;
}
};