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

cli application 'terminal.js' does not detect 'close' events (USB device disconnect) #1659

Closed
ccurtis0 opened this issue Sep 12, 2018 · 0 comments · Fixed by #1664
Closed
Labels

Comments

@ccurtis0
Copy link

Summary of Problem

This is spun off from issue #1465

Using the application ./node_modules/serialport/bin/terminal.js to debug a problem I was being misled because this application does not capture the 'close' signal, which is the only signal sent when a USB device providing a serial port is detached.

Steps and Code to Reproduce the Issue

  • Insert a USB to serial adapter
  • Run ./node_modules/serialport/bin/terminal.js -p /dev/ttyUSB0
  • Disconnect the USB device

Package name(s) and version(s)

serialport 7.0.2

Node version, Operating System and hardware

node 8.10.0
Ubuntu 18.04, Linux version 4.15.0-23
Intel Atom E3845

Adding the following code resolves the problem:

  port.on('close', err => {
    console.log('Closed', err)
    process.exit(1)
  })

With this, the USB disconnect event terminates the application.

reconbot added a commit that referenced this issue Sep 15, 2018
- update cli docs
- fix #1659 close / disconnect error for serialport-terminal
- rename serialport-term to serialport-terminal
reconbot added a commit that referenced this issue Sep 15, 2018
- update cli docs
- fix #1659 close / disconnect error for serialport-terminal
- rename serialport-term to serialport-terminal
- stop `test:require` because it's not necessary and breaks on the cli packages
reconbot added a commit that referenced this issue Sep 15, 2018
- update cli docs
- fix #1659 close / disconnect error for serialport-terminal
- rename serialport-term to serialport-terminal
- stop `test:require` because it's not necessary and breaks on the cli packages
@reconbot reconbot added the bug label Sep 15, 2018
reconbot added a commit that referenced this issue Sep 15, 2018
- update cli docs
- fix #1659 close / disconnect error for serialport-terminal
- rename serialport-term to serialport-terminal
- stop `test:require` because it's not necessary and breaks on the cli packages
@lock lock bot locked as resolved and limited conversation to collaborators Mar 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

2 participants