Bug 2965

Summary: OpenSSH for Windows hangs if there is no STDIN
Product: Portable OpenSSH Reporter: leese
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED INVALID    
Severity: enhancement CC: djm
Priority: P5    
Version: 7.9p1   
Hardware: Other   
OS: Windows 10   

Description leese 2019-02-06 09:12:26 AEDT
The simplest repro is to run the following in a cmd shell:

> ssh user@host -- echo x < NUL:
x
GetConsoleMode on STD_INPUT_HANDLE failed with 6


... and then it hangs and is unresponsive to input. If instead you pipe in an empty file it works fine.

This becomes a pain when you are writing a script that shells out to ssh to run a single remote command, as you need to provide a stdin file or it will hang. So for example, in python on Windows:

subprocess.check_output(['ssh', 'user@host', '--', 'echo', 'x'])

will hang.
Comment 1 Damien Miller 2019-02-08 14:57:33 AEDT
It looks like you're using the Microsoft OpenSSH client. Is this the case?

If so, you'll need to report the bugs on their github tracker https://github.com/PowerShell/Win32-OpenSSH/issues as their code is a fairly substantial fork from what we release.
Comment 2 leese 2019-02-09 03:40:43 AEDT
I am using Microsoft OpenSSH and it appears they already know about this issue (https://github.com/PowerShell/Win32-OpenSSH/issues/1330)
Comment 3 Damien Miller 2021-04-23 15:11:00 AEST
closing resolved bugs as of 8.6p1 release