I have a function like this:
const runInteractive = (rows, dups) => {
const keys = new Set(dups);
const questions = _(rows)
.filter(row => keys.has(row.key))
.groupBy(row => row.key)
.map((rows, key) => ({
type: 'list',
name: key.replace('.', ','),
message: `Pick a value for ${key}`,
choices: rows.map(row => ({ name: row.value, value: row, short: '✔' }))
}))
.value();
return inquirer
.prompt(questions)
.then(answers => _.sortBy(rows.filter(row => !keys.has(row.key)).concat(Object.values(answers)), row => row.key));
};
I invoke it from a shebang node script.
The process is displaying the inquirer prompt and then dying.
How can I keep it alive for the user to enter input?