endpoint 2.0 dysnomia.ptr.pet
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

properly 'cd' into sourced file's pwd

dawn 5d442771 bab1df6f

+9 -3
+9 -3
src/cmd/source_file.rs
··· 1 + use std::sync::Arc; 2 + 1 3 use crate::{ 2 4 error::{CommandError, to_shell_err}, 3 - globals::{get_pwd, print_to_console}, 5 + globals::{get_pwd, get_vfs, print_to_console, set_pwd}, 4 6 }; 5 7 use nu_engine::{CallExt, get_eval_block_with_early_return}; 6 8 use nu_parser::parse; 7 9 use nu_protocol::{ 8 - Category, PipelineData, ShellError, Signature, SyntaxShape, Type, 10 + Category, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value, 9 11 engine::{Command, EngineState, Stack, StateWorkingSet}, 10 12 }; 11 13 ··· 38 40 let span = call.arguments_span(); 39 41 let path: String = call.req(engine_state, stack, 0)?; 40 42 41 - let path = get_pwd().join(&path).map_err(to_shell_err(span))?; 43 + let pwd = get_pwd(); 44 + 45 + let path = pwd.join(&path).map_err(to_shell_err(span))?; 42 46 let contents = path.read_to_string().map_err(to_shell_err(span))?; 43 47 48 + set_pwd(path.parent().into()); 44 49 let res = eval(engine_state, stack, &contents, Some(&path.filename())); 50 + set_pwd(pwd); 45 51 46 52 match res { 47 53 Ok(d) => Ok(d),