You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove unnecessary use of eval from install script
The "template" installation script hosted in this repository contains a `checkLatestVersion()` function which is used to
determine the latest version of the project when the user does not specify a version to install.
The version number is required by the caller, but shell functions do not support returning such content.
As a workaround, the script author set up a system where the caller passed an arbitrary variable name to the function.
The function then sets a global variable of that name with the release name. So it resembles a "pass by reference"
approach, but isn't.
This was done using the `eval` builtin. This tool must be used with caution and best practices is to avoid it unless
absolutely necessary. The system used by the script has some value for a reusable function. However, in this case the
function is only intended for internal use by the script, and is called only once. So the unintuitive nature of this
system and potential for bugs don't bring any benefits when compared with the much more straightforward approach of
simply using a fixed name for the global variable used to store the release name.
0 commit comments