mirror of
https://github.com/nushell/nushell.git
synced 2025-01-23 06:39:17 +01:00
Don't report error when cwd is not exists. (#5590)
* only set cwd for child process if cwd exists, and avoid showing error when pwd is not exists * better comment text Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
parent
0d06b6259f
commit
6efd1bcb3f
@ -220,10 +220,7 @@ pub fn eval_source(
|
||||
}
|
||||
};
|
||||
|
||||
if let Err(err) = engine_state.merge_delta(delta, Some(stack), &cwd) {
|
||||
let working_set = StateWorkingSet::new(engine_state);
|
||||
report_error(&working_set, &err);
|
||||
}
|
||||
let _ = engine_state.merge_delta(delta, Some(stack), &cwd);
|
||||
|
||||
match eval_block(engine_state, stack, &block, input, false, false) {
|
||||
Ok(mut pipeline_data) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command as CommandSys, Stdio};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::mpsc;
|
||||
@ -339,7 +339,10 @@ impl ExternalCommand {
|
||||
self.create_command(d)?
|
||||
};
|
||||
|
||||
// do not try to set current directory if cwd does not exist
|
||||
if Path::new(&d).exists() {
|
||||
process.current_dir(d);
|
||||
}
|
||||
process
|
||||
} else {
|
||||
return Err(ShellError::GenericError(
|
||||
|
Loading…
Reference in New Issue
Block a user