mirror of
https://github.com/starship/starship.git
synced 2024-11-22 16:23:17 +01:00
fix(docker_context): ignore unix domain socket path from Docker Context (#5616)
* fix(modules): ignore unix domain socket path from Docker Context fix #5548 * refactor(docker_context): ignore docker_context on unix domain socket path Closes #5548
This commit is contained in:
parent
00d3dc86a2
commit
a910e094f7
@ -57,7 +57,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
||||
}
|
||||
};
|
||||
|
||||
if ctx == "default" {
|
||||
if ctx == "default" || ctx.starts_with("unix://") {
|
||||
return None;
|
||||
}
|
||||
|
||||
@ -293,6 +293,24 @@ mod tests {
|
||||
cfg_dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_docker_host_env_with_unix_path() -> io::Result<()> {
|
||||
let cfg_dir = tempfile::tempdir()?;
|
||||
|
||||
let actual = ModuleRenderer::new("docker_context")
|
||||
.env("DOCKER_HOST", "unix:///run/user/1001/podman/podman.sock")
|
||||
.config(toml::toml! {
|
||||
[docker_context]
|
||||
only_with_files = false
|
||||
})
|
||||
.collect();
|
||||
let expected = None;
|
||||
|
||||
assert_eq!(expected, actual);
|
||||
|
||||
cfg_dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_docker_context_env() -> io::Result<()> {
|
||||
let cfg_dir = tempfile::tempdir()?;
|
||||
|
Loading…
Reference in New Issue
Block a user