-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: ensure PATH is always set #93
Conversation
7da11ee
to
57b6bfd
Compare
@@ -199,6 +200,9 @@ class DenoBridge { | |||
env.DENO_DIR = this.denoDir | |||
} | |||
|
|||
// Ensure PATH is always set as otherwise we are not able to find the global deno binary | |||
env[pathKey()] = inputEnv[pathKey({ env: inputEnv })] || process.env[pathKey()] |
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.
Doesn't pathKey
always need the environment variables passed in?
If I look at this correctly, and if the variable happens to be PATH
on Windows, you're then setting it as Path
in the final env object?
Or am I misunderstanding? 🤔
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.
It sets path to whatever the PATH
casing is in process.env
.
So if someone passes in PATH
, it will be converted to Path
on windows, or whatever the current casing is.
So from the outside of the bridge you do not need to care about windows or not.
PR #82 broke the detection of global installed binaries. The detection of the binary uses all environment variables and finds the global binary. When we then run the edge function with
deno ...
deno is not found because PATH is not there anymore.I don't like this solution, but I like the alternative even less. The only alternative i could come up is using
node-which
package to find the absolute path to the global binary. But not sure if we really want to add that overhead?What do you think? This means that edge functions in dev will have PATH available.