SBoudrias/Inquirer.js

A null shows in the prompt using mqtt.js

Opened this issue · 1 comments

muka commented

I found a wired issue which seems to be caused by mqtt.js using typescript

npm i mqtt inquirer@8.2.6
    const askMessage = () => {
      return feature.prompt([
        {
          name: 'message',
          message: 'Your message',
          type: 'input',
        },
      ]);
    };

await askMessage()

image

const client = mqtt.connect('mqtt://test.mosquitto.org')
await askMessage()

image

If mqtt.connect is called, the inquirer prompt will show a null and a new line. Any suggestion on why this may be happening ?

Ohh that's weird...

It looks like mqtt is either sending events/data to the process.stdin or is messing with the readline.

I don't see any obvious note on their README, but I'd check for option to either mute the logging or give the tool a different stream to send their writes to.

Waiting for the connection to complete could also help 🤷🏻