node-ssh
node-ssh copied to clipboard
cwd not support ~
ssh.execCommand('pwd', { cwd: '~/server/bin' }).then(function(result) {
console.log('STDOUT: ' + result.stdout)
console.log('STDERR: ' + result.stderr)
})
result in cd '~/server/bin' ; pwd
then goto error: bash: line 0: cd: ~/server/bin: No such file or directory
It's a limitation coming from the way things work, cannot help much in this regard without complicating things a lot.
One alternative in this situation would be to spawn a shell, execute this command in there, and then print pwd. Try running (with exec) 'bash', ['-c', 'cd ~/server/bin', 'pwd'] and tell me if that works