mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +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:
@ -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)?
|
||||
};
|
||||
|
||||
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
|
||||
} else {
|
||||
return Err(ShellError::GenericError(
|
||||
|
Reference in New Issue
Block a user