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

Command execution exit-status is always 0 #421

Closed
JmFixit opened this issue Nov 30, 2016 · 3 comments
Closed

Command execution exit-status is always 0 #421

JmFixit opened this issue Nov 30, 2016 · 3 comments
Assignees
Milestone

Comments

@JmFixit
Copy link

JmFixit commented Nov 30, 2016

Reproducible on 0.0.2.0 to Version 0.0.4.0

When command is executed exit code should be within the exit-status response however starting from 0.0.2.0 to 0.0.4.0 its always 0.
How to reproduce:
ssh -v Administrator@WIN_HOST "EXIT 66"
or
ssh -v Administrator@WIN_HOST "cmd.exe /C EXIT 66"
Expected result:
Correct 66 ssh command exit status should be reported.
Actual result:
0 is reported

ssh log from version 0.0.4.0 when such command is executed:
.........
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 3592, received 5248 bytes, in 0.1 seconds
Bytes per second: sent 53405.6, received 78026.9
debug1: Exit status 0
.........

Correctly working ssh server on linux log:
ssh -v root@localhost "exit 66"
....
ebug1: Sending command: exit 66
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 1960, received 2096 bytes, in 0.0 seconds
Bytes per second: sent 211484.8, received 226159.2
debug1: Exit status 66
...

Note: exit status works correctly on version 0.0.1.0

@arif-pragmasys
Copy link
Contributor

When we execute a command like following:
ssh -v -T test1@server "cmd /c exit 2"
on the server side , the following is executed
......\ssh-shellhost.exe -nopty cmd /c exit 2

sshd server is returning the exit code of 'ssh-shellhost.exe' which always happens to be 0.
We should look into ssh-shellhost.exe so that is propagates the correct exit code of the executed command.

@rgl
Copy link

rgl commented Jan 6, 2017

any news on this? for doing any kind of remote automation this is essential to have working.

manojampalam added a commit to PowerShell/openssh-portable that referenced this issue Jan 7, 2017
@manojampalam manojampalam added this to the January-Mid milestone Jan 7, 2017
@manojampalam
Copy link
Contributor

Fixed in PowerShell/openssh-portable#43. Will be available in next drop.

manojampalam added a commit to PowerShell/openssh-portable that referenced this issue Jan 7, 2017
@manojampalam manojampalam self-assigned this Jan 14, 2017
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

4 participants