Skip to content
This repository has been archived by the owner on Feb 5, 2022. It is now read-only.

Unable to close connection #53

Open
reggi opened this issue Jan 7, 2016 · 2 comments
Open

Unable to close connection #53

reggi opened this issue Jan 7, 2016 · 2 comments

Comments

@reggi
Copy link
Contributor

reggi commented Jan 7, 2016

Hey @spmjs thanks for the awesome libray!

I'm unable to close the connection. I have a really simple example like this. No errors occur and the process never exists. Any help would be amazing.

import scpClient from 'scp2'
scpClient.scp(source, dest, function(err) {
  if (err) {
    scpClient.close()
    return reject(err)
  } else {
    scpClient.close()
    return resolve()
  }
})
@reggi
Copy link
Contributor Author

reggi commented Jan 13, 2016

Hey @lepture is there any way to close a connection? My process doesn't end with .close()?

My code is very simple and still wont close :(

import scpClient from 'scp2'

const SSH_HOST = process.env.SSH_HOST
const SSH_USER = process.env.SSH_USER
const SSH_PASS = process.env.SSH_PASS

let buildSCPFile = (file) => `${SSH_USER}:${SSH_PASS}@${SSH_HOST}:/home/user/temp/${file}`

scpClient.scp(buildSCPFile('file.sql'), './temp/file.sql', function(err) {
  console.log('done')
  scpClient.close()
})

@rw355
Copy link

rw355 commented Dec 6, 2016

I think scpClient.close() closes the ssh session. To close your process, you can do:

process.exit();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants