Skip to content

When exiting ssh session on nerves device, Toolshed's exit function exits with an error code of 255 #85

@mitirmizi

Description

@mitirmizi

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 check echo $? you get 0. But with ssh nerves.local when you give command exit and check with echo $? 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:

ssh nerves.local
exit
echo $?
$ 255

Expected behavior
Overview: When we exit from nerves ssh, output of echo $? should be 0. If ssh nerves.local command fails the output of
echo $? should be 255.

ssh nerves.local
exit
echo $?
$ 0

SFTP with nerves works fine so if anyone wants to check that to confirm he can:

sftp nerves.local
ls
exit
$ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions