fix(bash): normalized msys paths in ls runtime
Applied brush-core's shell path normalizer in LsRuntime and added an end-to-end Windows regression for listing an MSYS drive alias. Fixes #8355
This commit is contained in:
@@ -3736,7 +3736,8 @@ struct LsRuntime {
|
||||
|
||||
impl LsRuntime {
|
||||
fn resolve(&self, path: impl AsRef<Path>) -> PathBuf {
|
||||
let path = path.as_ref();
|
||||
let normalized_path = brush_core::sys::fs::normalize_shell_path(path.as_ref());
|
||||
let path = normalized_path.as_ref();
|
||||
if path.is_absolute() { path.to_path_buf() } else { self.cwd.join(path) }
|
||||
}
|
||||
|
||||
@@ -5238,6 +5239,23 @@ mod integration_tests {
|
||||
assert_eq!(capture.out(), "visible-name\n");
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn resolves_msys_drive_alias_operands() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
File::create(dir.path().join("visible-name")).unwrap();
|
||||
let native = dir.path().to_string_lossy().replace('\\', "/");
|
||||
let (drive, tail) = native
|
||||
.split_once(":/")
|
||||
.unwrap_or_else(|| panic!("expected drive-qualified temp path, got {native:?}"));
|
||||
let alias = format!("/{}/{}", drive.to_ascii_lowercase(), tail);
|
||||
|
||||
let (code, capture) = run_util::<Ls>(&[&alias], "", dir.path());
|
||||
|
||||
assert_eq!(code, 0);
|
||||
assert_eq!(capture.out(), "visible-name\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_quoting_style_from_the_shell_environment() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user