Skip to content

Commit 541bfc9

Browse files
committed
Use current platform for binary extension, not target platform
The platform option specifies the target platform for the binary being downloaded, but the binary is executed on the current platform. Use WIN32 constant for determining the extension since that's where execution happens. Example: On Windows with platform: 'linux', generates binary-linux-arm64.cmd which can be executed as a script wrapping the actual binary.
1 parent 2a6488f commit 541bfc9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

registry/src/lib/dlx-binary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ export async function dlxBinary(
250250
const cacheDir = getDlxCachePath()
251251
const cacheKey = generateCacheKey(url)
252252
const cacheEntryDir = path.join(cacheDir, cacheKey)
253-
// Use target platform for extension when generating binary name.
254-
const ext = targetPlatform === 'win32' ? EXT_CMD : ''
253+
// Use current platform for extension since we'll execute on current platform.
254+
const ext = WIN32 ? EXT_CMD : ''
255255
const binaryName = name || `binary-${targetPlatform}-${arch}${ext}`
256256
const binaryPath = normalizePath(path.join(cacheEntryDir, binaryName))
257257

0 commit comments

Comments
 (0)