diff --git a/src/commands/command.rs b/src/commands/command.rs index 5f3f4809bd..6677dfbd7e 100644 --- a/src/commands/command.rs +++ b/src/commands/command.rs @@ -589,17 +589,22 @@ impl Command { out.to_output_stream() } else { let nothing = Value::nothing().tagged(Tag::unknown()); + let call_info = raw_args .clone() .call_info - .evaluate(®istry, &Scope::it_value(nothing.clone())) - .unwrap(); + .evaluate(®istry, &Scope::it_value(nothing.clone())); - match command - .run(&call_info, ®istry, &raw_args, nothing) - .into() - { - Ok(o) => o, + match call_info { + Ok(call_info) => { + match command + .run(&call_info, ®istry, &raw_args, nothing) + .into() + { + Ok(o) => o, + Err(e) => OutputStream::one(Err(e)), + } + } Err(e) => OutputStream::one(Err(e)), } } diff --git a/src/evaluate/evaluator.rs b/src/evaluate/evaluator.rs index df3186808f..9313d0fe5c 100644 --- a/src/evaluate/evaluator.rs +++ b/src/evaluate/evaluator.rs @@ -177,6 +177,18 @@ fn evaluate_reference( let config = crate::data::config::read(tag.clone(), &None)?; Ok(Value::row(config).tagged(tag)) } + x if x == "nu:path" => { + let mut table = vec![]; + match std::env::var_os("PATH") { + Some(paths) => { + for path in std::env::split_paths(&paths) { + table.push(Value::path(path).tagged(&tag)); + } + } + _ => {} + } + Ok(Value::table(&table).tagged(tag)) + } x => Ok(scope .vars .get(x)