Exit when the user press ctl+c when waiting to add the token and press any key to continue for the share command

This commit is contained in:
Mohammad Fares 2019-01-26 17:12:59 +01:00
parent ed1178a65c
commit d3e2d41be6

View File

@ -68,7 +68,12 @@ function getToken(context) {
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.once('data', function handler() {
process.stdin.once('data', function handler(data) {
// Check if CTRL+C is pressed to exit
if (data == '\u0003' || data == '\u0003') {
process.exit();
}
console.log(di.chalk.dim('Enjoy !') + '\n');
process.stdin.pause();