Skip to content

feat: allow binaryDestination to accept a full path to the CLI binary#879

Open
EhabY wants to merge 2 commits intomainfrom
feat/binary-destination-file-path
Open

feat: allow binaryDestination to accept a full path to the CLI binary#879
EhabY wants to merge 2 commits intomainfrom
feat/binary-destination-file-path

Conversation

@EhabY
Copy link
Copy Markdown
Collaborator

@EhabY EhabY commented Apr 9, 2026

  • The coder.binaryDestination setting (and CODER_BINARY_DESTINATION env var) now accepts a file path in addition to a directory path.
  • When the path points to an existing file, the extension uses it directly. If the version mismatches the server and downloads are enabled, it re-downloads to the same path. If downloads are disabled, the existing binary is used with a warning.
  • When the path points to a directory, the extension now checks for the platform-specific name (coder-linux-amd64) first, then falls back to the simple name (coder / coder.exe). This supports package-manager-installed CLIs (e.g. via apt, brew, winget) that use the simple name.
  • Adds cliUtils.simpleName() and a unified resolveBinaryPath() method in CliManager used by both locateBinary() and fetchBinary().

Resolves #861

The coder.binaryDestination setting (and CODER_BINARY_DESTINATION env
var) now accepts either a file path or a directory path:

- File path (e.g. /usr/bin/coder): if the file exists, use it directly.
  Version is checked and reported. If the version mismatches and
  downloads are enabled, the binary is re-downloaded to the same path.
  If downloads are disabled, the existing binary is used as-is with a
  warning.

- Directory path (existing behavior): look for the platform-specific
  name (e.g. coder-linux-amd64) first, then fall back to the simple
  name (coder / coder.exe). This supports package-manager-installed
  CLIs that use the simple name.

Adds cliUtils.simpleName() returning "coder" (or "coder.exe" on
Windows) and a unified resolveBinaryPath() method in CliManager used
by both locateBinary() and fetchBinary().

Resolves #861
@EhabY EhabY self-assigned this Apr 9, 2026
Always download to the platform-specific binary name (coder-linux-amd64)
for temp files, old backups, signatures, and lock files. After a
successful download, rename the result to the user's configured file
name while still holding the lock to avoid races with other windows.

Scoped rmOld to only clean files prefixed with the binary basename so
it does not accidentally remove unrelated files when the target
directory is shared (e.g. /usr/bin).
@EhabY EhabY force-pushed the feat/binary-destination-file-path branch from 2eb60c3 to d8f1641 Compare April 9, 2026 16:10
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.

Allow binaryDirectory setting to accept a full path to the CLI binary

1 participant