fix(tvix/eval): don't coerce variable name to string
Change-Id: I8aa878dee009901feb453c489ce37c12fa3a31a8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7026 Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
96dcc51297
commit
db70c672cf
2 changed files with 4 additions and 3 deletions
|
@ -11,15 +11,15 @@ use std::{
|
|||
use crate::{
|
||||
errors::ErrorKind,
|
||||
observer::NoOpObserver,
|
||||
value::{Builtin, CoercionKind, NixAttrs, NixString, Thunk},
|
||||
value::{Builtin, NixAttrs, NixString, Thunk},
|
||||
vm::VM,
|
||||
SourceCode, Value,
|
||||
};
|
||||
|
||||
fn impure_builtins() -> Vec<Builtin> {
|
||||
vec![
|
||||
Builtin::new("getEnv", &[true], |args: Vec<Value>, vm: &mut VM| {
|
||||
Ok(env::var(args[0].coerce_to_string(CoercionKind::Weak, vm)?)
|
||||
Builtin::new("getEnv", &[true], |args: Vec<Value>, _: &mut VM| {
|
||||
Ok(env::var(args[0].to_str()?)
|
||||
.unwrap_or_else(|_| "".into())
|
||||
.into())
|
||||
}),
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
builtins.getEnv { var = "PATH"; __toString = self: self.var; }
|
Loading…
Reference in a new issue