Skip to content

Instantly share code, notes, and snippets.

@kkeeth
Last active October 10, 2019 22:55
Show Gist options
  • Save kkeeth/10d93542a1dbaa8a7211786ecf69a599 to your computer and use it in GitHub Desktop.
Save kkeeth/10d93542a1dbaa8a7211786ecf69a599 to your computer and use it in GitHub Desktop.
const readline = require('readline')
const reader = readline.createInterface({
input: process.stdin,
output: process.stdout
})
reader.on('line', line => {
if (line !== "fin") {
console.log(line)
reader.prompt()
}
else {
reader.emit('close')
}
})
reader.on('close', () => {
console.log("bye bye !!")
process.exit(1)
})
reader.prompt()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment