-
Notifications
You must be signed in to change notification settings - Fork 768
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
SSH hang when running ssh with std_handles redirected on Win10 #1330
Comments
Underlying issue is the same discussed in #856. The IO on /dev/null (specified via -n) is somehow getting hung when NUL is explicitly redirected.
I've put a workaround for the issue and you should have it in next release. |
Big thanks for the quick response! |
PowerShell/Win32-OpenSSH#1330 Issue: open(dev/nul) returns a handle is passes isatty() test (i.e its being treated as a terminal handle by OS). This handle seems to work fine for as a console handle for console APIs, except when NUL is explicitly redirected. This works ssh -n target hostname but this hangs due to a deadlock from writing a log entry on a console API failure ssh -n target hostname < NUL Fix: Ignore console API failures when the handle is being reported as invalid.
Somehow, this still seems to be a problem with OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 (which got installed by Windows for me). When I run a command like I found this out after searching heavily after not being able to perform a Is there a more recent version I could install on my Windows 10 machine? |
See: https://github.com/PowerShell/Win32-OpenSSH/releases Unfortunately Microsoft is still installing the 7.7p1 version even with current Win10 versions, although newer ssh versions have been released and a lot of bugs have been fixed in the mean time. |
Please answer the following
"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
=> 7.9.0.0Server OperatingSystem
Linux 4.4.91 #1-NixOS SMP x86_64 GNU/Linux
also tested with "sshd" on Windows Srv 2016
sshd version:
Remote protocol version 2.0, remote software version OpenSSH_7.6
Client OperatingSystem
Windows 10 Pro - 1709 - Build 16299.785
What is failing
ssh.exe hangs when executing remote commands and std_handles are being redirected.
Example:
ssh -n -T user@server ls < NUL > stdout.txt 2> stderr.txt
Expected behavior
Command should be executed and the output of "ls" should be written to stdout.txt. ssh should terminate after execution.
Actual behavior
Command gets executed and the output of "ls" is being written to stdout.txt. ssh DOES NOT terminate after execution (hangs). If you kill the command process and inspect stdout.txt the expected output is there. So the remote command did complete.
The same command works without problems on Win7
The text was updated successfully, but these errors were encountered: