allow remote binary customization by drzraf · Pull Request #6013 · wp-cli/wp-cli

@drzraf

Could be set to use /custom/path/wp on the remote end but also sudo -u user /some/wp to allow running wp under a distinct user.

See also #5974

@mrsdizzie

@drzraf

So that case of "let the remote user specify what wp is" seems already covered by existing practices.

non-interactive mode is not firing a "login-shell". ~/.bashrc isn't read and the aliases it may contain are not defined.

@mrsdizzie

@drzraf

It addresses the problem in a way that doesn't need any hook nor modification on the remote server (like .bashrc to add aliases), either because:

  • These are not available
  • It's undesirable (because it need to work for multiple users with distinct .bashrc)
  • Because it's cumbersome to enable alias expansion, just to set on wp alias just to run wp with sudo under another user.

(and the diff in the codebase is just one-line)

@codecov-commenter

@mrsdizzie

I think WP_CLI_BINARY is too vague because it is only used in SSH context with this PR. We already have WP_CLI_SSH_PRE_CMD so maybe this could be WP_CLI_SSH_BINARY / WP_CLI_SSH_REMOTE_BINARY / WP_CLI_SSH_REMOTE_WP_BINARY

Suggesting because these should also end up documented here in the list of all available ENV Vars that WP CLI supports and every other use of WP_CLI_XXX is for the local version, not the remote.

@drzraf

I'm fine renaming it for whatever gets your preference. Just let me know.

@mrsdizzie

WP_CLI_SSH_BINARY seems fine to me (can add documentation separately)

…o `sudo -u user /some/wp` would also allow running remote `wp-cli` under a distinct user

mrsdizzie