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

cwd not support ~ #443

Open
zgpio opened this issue Sep 14, 2022 · 1 comment
Open

cwd not support ~ #443

zgpio opened this issue Sep 14, 2022 · 1 comment

Comments

@zgpio
Copy link

zgpio commented Sep 14, 2022

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

@steelbrain
Copy link
Owner

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

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

No branches or pull requests

2 participants