-
Notifications
You must be signed in to change notification settings - Fork 17
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
When exiting ssh session on nerves device, Toolshed's exit function exits with an error code of 255 #85
Comments
Thanks for the report. It looks like there are two issues:
As a workaround, use $ ssh nerves.local '
IO.puts("hello")
IO.puts("world")
'
Warning: Permanently added 'nerves.local,192.168.7.98' (RSA) to the list of known hosts.
hello
world
:ok%
$ echo $?
0 Having said that, I agree that it would be really nice to fix |
Thanks a lot @fhunleth for the response. The solution above works. I pasted this here just so that this remains as a pointer and in future someone might be able to fix it. Thing is that commands in bash heredocs shows the output from the device (which enhances the experience significantly, in my opinion) whereas, running using |
@herozero777 Do you plan on submitting a PR to fix this issue? |
I'd like to but I have no idea what is causing this issue or where to look for the solution. I checked the flags that can be passed to
Apart from this I'm out of ideas. |
Describe the bug
When we are ssh into a nerves device, we use Toolshed's exit function to close our ssh connection. The problem is that unlike a normal ssh session closing, closing nerves ssh session looks like an error to our bash shell. E.g. normally when you do
ssh remote.server
and exit afterwards, if you checkecho $?
you get 0. But withssh nerves.local
when you give command exit and check withecho $?
you get 255. This is the same error code you get if you failed to ssh into nerves device, thus making it impossible for a script to tell whether it failed to make connection with a nerves device or it made a connection and ran everything successfully.To Reproduce
Overview: ssh into a nerves device and exit, next check the command's status with
echo $?
. You can follow the commands as:Expected behavior
Overview: When we exit from nerves ssh, output of
echo $?
should be 0. Ifssh nerves.local
command fails the output ofecho $?
should be 255.SFTP with nerves works fine so if anyone wants to check that to confirm he can:
The text was updated successfully, but these errors were encountered: