Commit 13522d4
committed
feat(dlx): add cross-platform binary resolution
Implement Windows binary wrapper resolution to match npm/npx behavior.
Critical for production-ready Windows support.
Changes:
- Added resolveBinaryPath() helper function
- On Windows: checks for .cmd, .bat, .ps1, .exe wrappers in priority order
- On Unix: uses path directly
- Order matches npm bin-links creation strategy
- Updated findBinaryPath() to resolve platform-specific wrappers
- Calls resolveBinaryPath() after determining raw binary path
- Ensures correct executable is found on Windows
- Enhanced executePackage() with Windows shell handling
- Detects .bat/.cmd/.ps1 files and sets shell: true
- Matches npm/npx execution behavior
- .exe files don't need shell mode
Aligns with npm/npx binary resolution:
1. npm creates platform-specific wrappers in node_modules/.bin/
2. On Windows: .cmd (CMD), .ps1 (PowerShell), bare (Git Bash)
3. On Unix: shell script wrapper
4. Socket now resolves these correctly
Fixes Windows compatibility gap identified in dlx code review.1 parent 62b1e47 commit 13522d4
1 file changed
Lines changed: 52 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
290 | 320 | | |
291 | 321 | | |
292 | 322 | | |
| 323 | + | |
293 | 324 | | |
294 | 325 | | |
295 | 326 | | |
| |||
348 | 379 | | |
349 | 380 | | |
350 | 381 | | |
351 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
352 | 386 | | |
353 | 387 | | |
354 | 388 | | |
| |||
462 | 496 | | |
463 | 497 | | |
464 | 498 | | |
465 | | - | |
| 499 | + | |
466 | 500 | | |
467 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
468 | 505 | | |
469 | 506 | | |
470 | 507 | | |
| |||
482 | 519 | | |
483 | 520 | | |
484 | 521 | | |
485 | | - | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
486 | 535 | | |
0 commit comments