Skip to content
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

Disconnect standard output/error streams from xdg-open and friends #180

Merged
merged 2 commits into from
Sep 25, 2020

Conversation

mjcheetham
Copy link
Collaborator

When using the Process class to open the user's default browser on Linux, utilities like xdg-open are used. Some of these utilities do not disconnect child processes from our standard input/output/error streams. At the same time, browsers like Chromium like to write to stdout and stderr, which gets fed back to Git or the user's terminal, respectively. The latter looks messy, and the former causes Git to fail.

On Linux, we instead manually locate a suitable 'shell execute' utility and launch them directly - this way we can redirect the standard output/error streams.

For Windows and macOS, this is not an issue and we continue to use the Framework code to do 'shell execute'.

Fixes #178

@mjcheetham mjcheetham added bug A bug in Git Credential Manager platform:linux Specific to a Linux-based platform auth:oauth Specific to OAuth2 authentication labels Sep 25, 2020
Introduce a `TryX` method version of the existing `LocateExecutable`
method on `IEnvironment`, for locating executables with `which` and
`where.exe`.
When using the `Process` class to open the user's default browser on
Linux, utilities like `xdg-open` are used. Some of these utilities
do not disconnect child processes from our standard input/output/error
streams. At the same time, browsers like Chromium like to write to
stdout and stderr, which gets fed back to Git or the user's terminal,
respectively. The latter looks messy, and the former causes Git to fail.

On Linux, we instead manually locate a suitable 'shell execute' utility
and launch them directly - this way we can redirect the standard
output/error streams.

For Windows and macOS, this is not an issue and we continue to use the
Framework code to do 'shell execute'.
@mjcheetham mjcheetham merged commit 13f53e0 into git-ecosystem:master Sep 25, 2020
@mjcheetham mjcheetham deleted the fix-webopen branch September 25, 2020 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth:oauth Specific to OAuth2 authentication bug A bug in Git Credential Manager platform:linux Specific to a Linux-based platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

warning: invalid credential line: Opening in existing browser session.
2 participants