-
Notifications
You must be signed in to change notification settings - Fork 10
fix ERL_ROOTDIR issues #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,11 @@ const replaceEnvVars = (str) => { | |||||
| /\$\{([a-zA-Z0-9_]+):\+:\$[a-zA-Z0-9_]+\}/g, | ||||||
| (_, key) => ((v) => v ? `:${v}` : "")(process.env[key]), | ||||||
| ) | ||||||
| // handles ${FOO:-bar} > $FOO || "bar" | ||||||
| .replaceAll( | ||||||
| /\$\{([a-zA-Z0-9_]+):-([^}]*)\}/g, | ||||||
| (_, key, defaultVal) => process.env[key] || defaultVal, | ||||||
|
||||||
| (_, key, defaultVal) => process.env[key] || defaultVal, | |
| (_, key, defaultVal) => (process.env[key] === undefined || process.env[key] === '') ? defaultVal : process.env[key], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states
${FOO:-bar} > $FOO || "bar"but this is misleading. In bash,${FOO:-bar}means "use$FOOif set and non-empty, otherwise usebar". The implementation uses the JavaScript||operator which has different semantics—it will also use the default for falsy values like0,false, or empty string (though empty string matches bash behavior).Consider updating the comment to be more accurate:
// handles ${FOO:-bar} - uses default if FOO is unset or falsyOr if you want to strictly match bash behavior (use default only when unset or empty):
// handles ${FOO:-bar} - uses default if FOO is unset or empty (bash-style)