mirror of
https://github.com/nushell/nushell.git
synced 2025-05-30 06:39:33 +02: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 _ = engine_state.merge_delta(delta, Some(stack), &cwd);
|
||||||
let working_set = StateWorkingSet::new(engine_state);
|
|
||||||
report_error(&working_set, &err);
|
|
||||||
}
|
|
||||||
|
|
||||||
match eval_block(engine_state, stack, &block, input, false, false) {
|
match eval_block(engine_state, stack, &block, input, false, false) {
|
||||||
Ok(mut pipeline_data) => {
|
Ok(mut pipeline_data) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{BufRead, BufReader, Write};
|
use std::io::{BufRead, BufReader, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command as CommandSys, Stdio};
|
use std::process::{Command as CommandSys, Stdio};
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
@ -339,7 +339,10 @@ impl ExternalCommand {
|
|||||||
self.create_command(d)?
|
self.create_command(d)?
|
||||||
};
|
};
|
||||||
|
|
||||||
process.current_dir(d);
|
// do not try to set current directory if cwd does not exist
|
||||||
|
if Path::new(&d).exists() {
|
||||||
|
process.current_dir(d);
|
||||||
|
}
|
||||||
process
|
process
|
||||||
} else {
|
} else {
|
||||||
return Err(ShellError::GenericError(
|
return Err(ShellError::GenericError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user