Bug 2965 - OpenSSH for Windows hangs if there is no STDIN
Summary: OpenSSH for Windows hangs if there is no STDIN
Status: CLOSED INVALID
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 7.9p1
Hardware: Other Windows 10
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-06 09:12 AEDT by leese
Modified: 2021-04-23 15:11 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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