-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Trailing colons in env breaks things #929
Changes from 1 commit
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 |
---|---|---|
|
@@ -24,6 +24,10 @@ export default async function(pkgenv: { installations: Installation[] }) { | |
|
||
for (const key in rv) { | ||
rv[key] = rv[key].replaceAll(new RegExp(`\\$${key}\\b`, 'g'), `\${${key}}`) | ||
// don’t end with a trailing `:` since that is sometimes interpreted as CWD and can break things | ||
// instead of `foo:${PATH}` we end up with `foo${PATH:+:PATH}` which is not POSIX but works | ||
// with all realy shells to avoid the trailing `:` | ||
rv[key] = rv[key].replaceAll(new RegExp(`:\\$\{${key}}`, 'g'), `\${${key}:+:$${key}}`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is succinct, but isn't it probably safer to do: .replaceAll(/::/, ':')
.replace(/^:/, '')
.replace(/:$/, '') ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you’re right. This isn’t good enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't bother with some of these as we construct this env ourselves. The runtime |
||
} | ||
|
||
return rv | ||
|
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.
s/realy/really/
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.
lol not even sure what I meant to say. “Really” doesn't make sense
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.
hm, actually, it's probably
real
.