fix(cli): normalize argv[1] path separators for Windows compatibility#600
fix(cli): normalize argv[1] path separators for Windows compatibility#600JonnieSparkles wants to merge 2 commits intoar-io:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughModified Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
On Windows, the CLI silently exits without output when run via
node lib/esm/cli/cli.jsor the globally installedar.iocommand. No error is thrown, nothing is printed — including--help.The root cause is the conditional at the bottom of
cli.tsthat determines whether to callprogram.parse():On Windows,
process.argv[1]uses backslashes, e.g.:Neither
'bin/ar.io'nor'cli/cli'match because the path containscli\cli, soprogram.parse()is never called and the CLI exits silently.Fix
Normalize the path separators before the check:
Testing
Confirmed on Windows (PowerShell) that:
node lib/esm/cli/cli.js --helpproduces no output--helpand commands likeget-arns-record --name ardrive --mainnetwork correctlyNo impact on macOS/Linux — backslashes don't appear in those paths so the replace is a no-op.
Summary by CodeRabbit
This release includes important fixes for cross-platform compatibility.