PowerShell / PowerShell/Win32-OpenSSH

Hangs when redirecting stdin from NUL

Open
#1,470 5 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

"OpenSSH for Windows" version
((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)

7.7.2.2

Client OperatingSystem

Windows 10.

What is failing

When running the following at a CMD prompt, the program prints an error and hangs indefinitely.

C:/WINDOWS/System32/OpenSSH/ssh.exe -- git@github.com "git-lfs-authenticate org/repo.git upload" <NUL

This causes this version of OpenSSH to hang with Git LFS, since Git LFS redirects standard input from /dev/null (in our case, using Go's standard library). This works fine for Unix versions of OpenSSH (and is in fact essential for scripting), so there's no reason it shouldn't also work fine for the Windows version.

Using the version of OpenSSH provided by Git for Windows works correctly.

See git-lfs/git-lfs#3779 for more details.

Expected output
The output from the remote side:

Repository not found

Actual output

GetConsoleMode on STD_INPUT_HANDLE failed with 6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue from a Windows CMD prompt using ssh.exe with stdin redirected from NUL, and inspect the reported GetConsoleMode failure. Confirm the behavior against the Git for Windows version and trace the OpenSSH Windows input-handling entry point; done means the command no longer hangs and returns the remote-side output.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.