Skip to content

Correctly check for GUI on Win/Mac/POSIX #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2020

Conversation

mjcheetham
Copy link
Collaborator

@mjcheetham mjcheetham commented Feb 12, 2020

Replace the PlatformUtils.IsDesktopSession util method with platform specific components that check use native APIs to determine the state of the current session.

Environment.UserInteractive is hard-coded to return true for POSIX and Windows platforms on .NET Core 2.x and 3.x.
dotnet/runtime#770

The .NET 5 implementation (not yet released) fixes this for the Windows platform only. We take a copy of that implementation for Windows.

On macOS we use the SessionGetInfo from the Security.framework.

On POSIX in general we also check for the X11 $DISPLAY environment variable.

@mjcheetham mjcheetham added the bug A bug in Git Credential Manager label Feb 12, 2020
@mjcheetham mjcheetham force-pushed the fix-desktopcheck branch 3 times, most recently from 94c7596 to 4e570e9 Compare February 14, 2020 16:55
Copy link
Collaborator

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot say that I am competent in this space, but the description and the changes make sense to me.

Replace the `PlatformUtils.IsDesktopSession` util method with platform
specific components that check use native APIs to determine the state of
the current session.

`Environment.UserInteractive` is hard-coded to return true for POSIX and
Windows platforms on .NET Core 2.x and 3.x.
dotnet/runtime#770

The .NET 5 implementation (not yet released) fixes this for the Windows
platform only. We take a copy of that implementation for Windows.

On macOS we use the `SessionGetInfo` from the Security.framework.

On POSIX in general we also check for the X11 $DISPLAY environment
variable.
@mjcheetham mjcheetham merged commit 1e0361a into git-ecosystem:master May 21, 2020
@mjcheetham mjcheetham deleted the fix-desktopcheck branch May 21, 2020 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug in Git Credential Manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants