Skip to content

Correct file descriptors on Windows#40

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

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

Conversation

@btoews
Copy link
Contributor

@btoews btoews commented Nov 29, 2018

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

Closes: #41

@btoews
Copy link
Contributor Author

btoews commented Dec 3, 2018

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

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
Copy link
Contributor Author

btoews commented Dec 3, 2018

👍 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