Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding listener to read data causes node to exit #1375

Closed
neimanpinchas opened this issue Oct 22, 2017 · 3 comments
Closed

Adding listener to read data causes node to exit #1375

neimanpinchas opened this issue Oct 22, 2017 · 3 comments

Comments

@neimanpinchas
Copy link

  • SerialPort Version:6.0.3

  • NodeJS Version:v6.11.2

  • Operating System and Hardware Platform:win 10 x86_64

  • Have you checked the right version of the api docs?:?

Summary of Problem

i am able to write to the serial port
when i am doing a port.on("readable or on("data the script ends immediately, even if the event queaue is not empty

Steps and Code to Reproduce the Issue

var SP= require('../');



var port = new SP("COM2");


port.on('error', function(err) {
  console.log('Error: ', err.message);
})

//when this is uncomented the script keeps running
port.on('data', function () {
  console.log('Data:');
});  


port.on('open', () => {
  console.log(`echo: Port open: COM2`);

    console.log('echo: READY!');



  //port.write("a");

 
});


//code to keep the event loop running
(function wait () {
   if (true) setTimeout(wait, 1000);
})();
@reconbot
Copy link
Member

@kimushu can you take a look? There might be another event loop issue.

@kimushu
Copy link
Contributor

kimushu commented Oct 24, 2017

oh,,, sorry. I made a mistake about reading in a latest commit. I'll send a pull request soon.

@neimanpinchas
Copy link
Author

neimanpinchas commented Oct 24, 2017 via email

@lock lock bot locked and limited conversation to collaborators Apr 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants