Skip to content

Commit 2e4efd3

Browse files
committed
fix: install env bindings for every context
Signed-off-by: Dario Valdespino <dvaldespino00@gmail.com>
1 parent 959ec96 commit 2e4efd3

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

  • packages/graalvm/src/main/kotlin/elide/runtime/plugins/env

packages/graalvm/src/main/kotlin/elide/runtime/plugins/env/EnvPlugin.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ import elide.vm.annotations.Polyglot
3333
* @see EnvConfig
3434
*/
3535
@DelicateElideApi public class Environment private constructor(public val config: EnvConfig) {
36-
@Volatile private var envInstalled = false
37-
3836
/** Collect the configured environment variables and keep the ones currently present. */
3937
private val effectiveEnvironment: Map<String, String> by lazy {
4038
config.app.isolatedEnvironmentVariables
@@ -98,10 +96,7 @@ import elide.vm.annotations.Polyglot
9896
*/
9997
public fun configure(scope: InstallationScope, context: PolyglotContext, language: GuestLanguage) {
10098
scope.deferred {
101-
if (!envInstalled) {
102-
envInstalled = true
103-
context.bindings(language).putMember(APP_ENV_BIND_PATH, proxiedEnvMap)
104-
}
99+
context.bindings(language).putMember(APP_ENV_BIND_PATH, proxiedEnvMap)
105100
}
106101
}
107102

@@ -138,6 +133,7 @@ import elide.vm.annotations.Polyglot
138133
*/
139134
@JvmStatic public fun forLanguage(languageId: String, context: Context): PolyglotValue {
140135
return context.getBindings(languageId).getMember(APP_ENV_BIND_PATH)
136+
?: error("Environment binding is not available for language $languageId in this context")
141137
}
142138
}
143139
}

0 commit comments

Comments
 (0)