/
githubmirror
/
yarn
Обзор
Документация
Войти
/
githubmirror
/
yarn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
__tests__/fixtures/install/install-blocking-script/blocking/install.js
25 строк
501 B
Rebecca Turner
fix(build): Stop scripts from trying to read user input during install (#5632)
19 апр 2018, 01:05
19 апр 2018, 01:05
2f0eb8e
Код
Авторство
О чём код?
const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, prompt: 'OHAI> ', }); rl.prompt(); rl .on('line', line => { switch (line.trim()) { case 'hello': console.log('world!'); break; default: console.log(`Say what? I might have heard '${line.trim()}'`); break; } rl.prompt(); }) .on('close', () => { console.log('Have a great day!'); process.exit(0); });