Tomas Romero
Tomas Romero

Reputation: 8708

MeteorJS: how to read stdin from the terminal?

Is it possible to read stdin from the terminal on a Meteor app? I want to run some prompts using Node's readline.

I tried the example at readline's page but I only get the prompt printed to the terminal without waiting for an answer:

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question("What do you think of node.js? ", function(answer) {
  // TODO: Log the answer in a database
  console.log("Thank you for your valuable feedback:", answer);

  rl.close();
});

This code works just fine in a plain NodeJS script.

Related tickets:

Upvotes: 4

Views: 213

Answers (1)

Abraham Serafino
Abraham Serafino

Reputation: 36

It doesn't look like this is possible for now. OP opened a related issue to MDG (https://github.com/meteor/meteor/issues/4836), which was subsequently closed.

The recommended way to write interactive command-line apps is to use Node directly.

Upvotes: 1

Related Questions