f-hj / slsk-client

🐦 Soulseek client for NodeJS
MIT License
178 stars 21 forks source link

Can't disconnect gracefully #35

Closed simonwjackson closed 5 years ago

simonwjackson commented 5 years ago
const slsk = require('slsk-client')

slsk.connect({
  user: 'user',
  pass: 'pass'
}, (err, client) => {
  client.search({
    req: 'random',
    timeout: 2000
  }, (err, res) => {
    if (err) return console.log(err)
    console.log(res)

    /* *** Trying to exit *** */
    client.destroy()
    slsk.disconnect()

  })
})

I cant exit the script without Ctrl-C. Am I doing something wrong here?

riteable commented 5 years ago

Is process.exit() not an option?

simonwjackson commented 5 years ago

I guess so, but It feels a bit hacky to rely on process.exit(). Is there no other way to do this?

f-hj commented 5 years ago

Should be fixed in 1.1.0