Skip to content

Conversation

Copy link

Copilot AI commented Feb 1, 2026

The wp admin command fails on SSH connections with "xdg-open: not found" because it attempts to open a browser on the remote server.

Changes

SSH Detection

  • Check SSH_CONNECTION, SSH_CLIENT, and SSH_TTY environment variables
  • Output URL directly when SSH detected instead of attempting browser open

Error Handling

  • Replace passthru() with exec() to capture return codes
  • Fallback to URL output when browser command fails (e.g., xdg-open not installed)

Example behavior on SSH:

$ wp admin
Detected SSH connection. Please open this URL in your local browser:
http://example.com/wp-admin/

Local behavior unchanged - still opens browser automatically on macOS/Windows/Linux.

Original prompt

This section details on the original issue you should resolve

<issue_title>Admin with SSH (remote) connections</issue_title>
<issue_description>Does this package work with ssh (remote) connections? I just tried it and got a "xdg-open: not found" error.</issue_description>

Comments on the Issue (you are @copilot in this section)

@schlessera @dicetomato No, that cannot work. How would the remote server be able to control your browser? @schlessera That being said, it could theoretically work if we bypass the normal SSH execution flow, and just return data from the site back to the admin command. Not sure whether that is easily doable, given the current architecture, though...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 1, 2026 17:21
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix admin SSH remote connection error handling Add SSH connection detection and fallback URL output Feb 1, 2026
Copilot AI requested a review from swissspidy February 1, 2026 17:23
@swissspidy swissspidy closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin with SSH (remote) connections

2 participants