You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This ticket is about refining the behavior for setting the environment of a newly started kernel. Right now, as it can be seen in this code reference the various options are shallow-merged. I.e. if there is a kernel-configured environment and a custom one passed in via the spawnOptions object, spawnOptions.env overwrites everything.
My idea about this is -- at least optionally, such that existing behavior isn't broken -- to merge these env configurations before they're passed to execa, i.e. a "deeper merge". In particular, this would allow to overwrite a single environment variable from the kernel config file, while the other ones are kept as they are. I'm for example thinking about a case, where variables like LD_LIBRARY_PATH and PATH are configured in the kernel, but I want to tweak PATH via spawnOptions and keep LD_LIBRARY_PATH as it is.
Since at least I find this confusing, I'm just clarifying this by an example:
Interesting points. I think your idea makes sense if you wanted to make a PR.
I am glad you are bringing up how this works as I wondered about this when we switched to execa. At the time, I opened #34 because I was unclear on how execa handles this and if it would work for us.
@haraldschilly If you're interested in opening a PR to make this modification, you'll need to do so in the nteract monorepo. We're actually deprecating this package and moving the logic here to the fs-kernels package. The code has been moved to this file.
haraldschilly
changed the title
(optionally) deep merge spawnOptions.env with kernelSpec.env
deep merge spawnOptions.env with kernelSpec.env
Feb 5, 2020
haraldschilly
added a commit
to haraldschilly/spawnteract
that referenced
this issue
Feb 5, 2020
This ticket is about refining the behavior for setting the environment of a newly started kernel. Right now, as it can be seen in this code reference the various options are shallow-merged. I.e. if there is a kernel-configured environment and a custom one passed in via the
spawnOptions
object,spawnOptions.env
overwrites everything.My idea about this is -- at least optionally, such that existing behavior isn't broken -- to merge these env configurations before they're passed to
execa
, i.e. a "deeper merge". In particular, this would allow to overwrite a single environment variable from the kernel config file, while the other ones are kept as they are. I'm for example thinking about a case, where variables likeLD_LIBRARY_PATH
andPATH
are configured in the kernel, but I want to tweakPATH
viaspawnOptions
and keepLD_LIBRARY_PATH
as it is.Since at least I find this confusing, I'm just clarifying this by an example:
merging
env
one level deeper preservesVAR
The text was updated successfully, but these errors were encountered: