From 58d002d469aa4fb57b7140c281eb1ef86ecd15f6 Mon Sep 17 00:00:00 2001 From: Chinmay Dalal Date: Sat, 2 Dec 2023 23:06:02 +0530 Subject: [PATCH] expose argv[0] as `$env.PROCESS_PATH` (#11203) closes #11059 # Description I'm not sure what the consensus was after discussing this in discord, so I'm creating a PR as suggested # User-Facing Changes TBD # Tests + Formatting TBD # After Submitting TBD --- crates/nu-cli/src/eval_file.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/nu-cli/src/eval_file.rs b/crates/nu-cli/src/eval_file.rs index 88f64da6e0..e630327697 100644 --- a/crates/nu-cli/src/eval_file.rs +++ b/crates/nu-cli/src/eval_file.rs @@ -98,6 +98,10 @@ pub fn evaluate_file( "CURRENT_FILE".to_string(), Value::string(file_path.to_string_lossy(), Span::unknown()), ); + stack.add_env_var( + "PROCESS_PATH".to_string(), + Value::string(path, Span::unknown()), + ); let source_filename = file_path .file_name()