Only use cygpath
on windows if present (#586)
This commit is contained in:
parent
1d084f1d4e
commit
1629235f2e
@ -88,6 +88,13 @@ impl PlatformInterface for Platform {
|
|||||||
cygpath.current_dir(working_directory);
|
cygpath.current_dir(working_directory);
|
||||||
cygpath.arg("--unix");
|
cygpath.arg("--unix");
|
||||||
cygpath.arg(path);
|
cygpath.arg(path);
|
||||||
output(cygpath).map_err(|e| format!("Error converting shell path: {}", e))
|
|
||||||
|
match output(cygpath) {
|
||||||
|
Ok(shell_path) => Ok(shell_path),
|
||||||
|
Err(_) => path
|
||||||
|
.to_str()
|
||||||
|
.map(str::to_string)
|
||||||
|
.ok_or_else(|| String::from("Error getting current directory: unicode decode error")),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2439,3 +2439,19 @@ test! {
|
|||||||
status: EXIT_FAILURE,
|
status: EXIT_FAILURE,
|
||||||
shell: false,
|
shell: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
test! {
|
||||||
|
name: pwsh_invocation_directory,
|
||||||
|
justfile: r#"
|
||||||
|
set shell := ["pwsh", "-NoProfile", "-c"]
|
||||||
|
|
||||||
|
pwd:
|
||||||
|
@Test-Path {{invocation_directory()}} > result.txt
|
||||||
|
"#,
|
||||||
|
args: (),
|
||||||
|
stdout: "",
|
||||||
|
stderr: "",
|
||||||
|
status: EXIT_SUCCESS,
|
||||||
|
shell: false,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user