Skip to content

Correct file descriptors on Windows - #40

Merged
btoews merged 2 commits into
masterfrom
windows-fd
Dec 4, 2018
Merged

Correct file descriptors on Windows#40
btoews merged 2 commits into
masterfrom
windows-fd

Conversation

@btoews

@btoews btoews commented Nov 29, 2018

Copy link
Copy Markdown
Contributor

A user reported that signature verification with Git wasn't working on Windows. Git passes --status-fd=1, which isn't the correct file descriptor for stdout on Windows. This RP works around this by special casing file descriptors 1 and 2 to mean stdout and stderr respectively.

@henning-schild

Copy link
Copy Markdown

Closes: #41

@btoews

btoews commented Dec 3, 2018

Copy link
Copy Markdown
Contributor Author

Continuing a conversation with @henning-schild from email: With regards to this PR relying on the magic numbers, I don't think there is a great alternative. On Unix systems, we can use syscall.Sydout and syscall.Stderr, but those won't be 1 and 2 on Windows. The problem is that Git always passes --status-fd=1, even on Windows where file descriptor 1 isn't stdout.

@henning-schild

Copy link
Copy Markdown

If you can not access the values of syscall_unix from windows, you could leave a comment or give them names with something like that:

var (
	UnixStdout = 1
	UnixStderr = 2
)

@btoews

btoews commented Dec 3, 2018

Copy link
Copy Markdown
Contributor Author

👍 I like that idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants