denoland / deno_task_shell

Cross-platform shell for deno task.
https://crates.io/crates/deno_task_shell
MIT License
108 stars 18 forks source link

fix: allow empty values for env vars by always inserting value #80

Closed magurotuna closed 1 year ago

magurotuna commented 1 year ago

This commit allows empty values for env vars in order to make the behavior consistent with the normal command execution.

Suppose we set an env var called FOO with export FOO= (note this is an empty), and we have a simple script that prints this env var:

console.log(`Foo: ${Deno.env.get("FOO")}`);

Running this script via deno run gets us Foo:. While via deno task (with "foo": "deno run --allow-env foo.ts" in deno.json) it gets us Foo: undefined. This might be a significant difference if it matters whether the env var is set or not. So this PR fixes this behavior by always setting given env vars even if they are empty.

I'm not really sure if there's a place where I can write a test case. Please let me know if there should be a test case.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

dsherret commented 1 year ago

Merging in main should fix the CI.