rockcarver / frodo-cli

A CLI to manage ForgeRock platform deployments supporting Identity Cloud tenants, ForgeOps deployments, and classic deployments.
MIT License
17 stars 16 forks source link

Inconsistent binary detection on Windows #267

Closed brain-hol closed 1 year ago

brain-hol commented 1 year ago

Frodo CLI version

# frodo -v
You seem to be running the NPM package
Installed versions:
cli: v1.0.0
lib: v1.1.0
node: v18.5.0

This is actually running from the binary, not NPM.

Describe the issue

The current implementation of frodo-cli lacks proper handling of binary detection on Windows. The code checks if the command name matches frodo, indicating that it's being run from a binary. However, on Windows, the executable name will be frodo.exe instead of just frodo.

Here's the relevant code snippet that performs the binary detection:

https://github.com/rockcarver/frodo-cli/blob/f66677899882c607e4d5551e352f073360cc2cbe/src/utils/Version.ts#L127-L129

As a result, when running frodo on Windows, the process incorrectly assumes it is not a binary, potentially leading to unexpected behavior or errors. For example, binary version comparison is not being handled correctly (related to #266).

To address this issue, the binary detection logic should be modified to handle both frodo and frodo.exe as valid binary names. This ensures consistent behavior across different platforms.

vscheuber commented 1 year ago

@brain-hol thank you for reporting this! Please validate the fix is working as expected. We should probably write unit tests for this and run them in our pipeline, which runs on all the target platforms. But that will be an effort I couldn't take on right now.