Conversation
Pull Request Test Coverage Report for Build 7547730951
💛 - Coveralls |
jhheider
reviewed
Jan 16, 2024
| 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 `:` |
Contributor
Author
There was a problem hiding this comment.
lol not even sure what I meant to say. “Really” doesn't make sense
Contributor
There was a problem hiding this comment.
hm, actually, it's probably real.
jhheider
reviewed
Jan 16, 2024
src/prefab/construct-env.ts
Outdated
| // 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}}`) |
Contributor
There was a problem hiding this comment.
this is succinct, but isn't it probably safer to do:
.replaceAll(/::/, ':')
.replace(/^:/, '')
.replace(/:$/, '')?
Contributor
Author
There was a problem hiding this comment.
Yeah, you’re right. This isn’t good enough.
Contributor
Author
There was a problem hiding this comment.
I didn't bother with some of these as we construct this env ourselves. The runtime env from the package.yml could in theory cause a preceding : I guess.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs pkgxdev/pantry#147