Skip to content

Lynx support: Open browser asynchronous with current tty as stdin/stdout - #97

Open
YouDirk wants to merge 1 commit into
hickford:mainfrom
YouDirk:lynx-support
Open

Lynx support: Open browser asynchronous with current tty as stdin/stdout#97
YouDirk wants to merge 1 commit into
hickford:mainfrom
YouDirk:lynx-support

Conversation

@YouDirk

@YouDirk YouDirk commented Oct 31, 2025

Copy link
Copy Markdown

This patch enables the option to login using the minimalistic console browser Lynx, if xdg-open is running it as default browser. Useful on remote machines without X-forwarding or VNC.

@google-cla

google-cla Bot commented Oct 31, 2025

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@YouDirk

YouDirk commented Nov 3, 2025

Copy link
Copy Markdown
Author

Does not work in conjunction with git command. I just tested the code with

$> printf "host=host.name.org\nprotocol=https\n" | git-credential-oauth get

which works fine. But inside git it doesn't work.

The issue may be that git forks git-credential-oauth with os.Std{in,out} not equal to the current tty. I'm looking forward to update the pull-request. If I do not get success then I will close this pull-request unmerged.

Greets, Dirk.

@YouDirk

YouDirk commented Nov 6, 2025

Copy link
Copy Markdown
Author

Hey, me again =D

this pull-request seems to work and is Ready-To-Merge.

I have published a test-build at YouDirk/git-credential-oauth/releases/v0.17.2.1 which you can try out ...

It seems to work fine. Just install lynx and xdg-open and it should hopefully work.

Greets, Dirk =D

This patch enables the option to login using the minimalistic console
browser Lynx, if xdg-open is running it as default browser.  Useful on
remote machines without X-forwarding or VNC.

How it works
************

Browsers stdin/stdout are outputting/reading to/from TTY if OS is
Linux.

Browsers are executed asynchronous, then git-credential-oauth is
waiting for the response of the temporary HTTP server, followed by
WAIT() until the browser was closed (or forked if GUI is available).
@YouDirk

YouDirk commented Feb 3, 2026

Copy link
Copy Markdown
Author

Once more ready to merge =) ...

Comment thread main.go
// Wait here until browser is terminated
if err := cmd.Wait(); err != nil {
fmt.Fprintf(os.Stderr, "Browser '%s' terminates with failure: %s\n", open, err)
}

@YouDirk YouDirk Jun 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removing lines 526-529 above could resolve #112 ... Please first merge this and afterwards try to fix #122.

[Edit]: But notice that console browsers like Lynx require termination. Otherwise the tty/console-output of both processes (console browser and git-credential-oauth) will be merged. If this fix #112 then deeper thoughts are required, i.e. browser detection like

	if <browser_type> == "console" {
		if err := cmd.Wait(); err != nil {
			fmt.Fprintf(os.Stderr, "Browser '%s' terminates with failure: %s\n", open, err)
		}
	}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ping for [Edit] above.

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.

1 participant