Skip to content

Commit

Permalink
refactor(docker_context): ignore docker_context on unix domain socket…
Browse files Browse the repository at this point in the history
… path

Closes #5548
  • Loading branch information
ananta committed Dec 16, 2023
1 parent 851cbb5 commit aa8a374
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/modules/docker_context.rs
Expand Up @@ -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;
}

Expand All @@ -72,9 +72,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
_ => None,
})
.map(|variable| match variable {
"context" => {
Some(Ok(if ctx.contains("unix://") { "" } else { ctx.as_str() }))
},
"context" => Some(Ok(ctx.as_str())),
_ => None,
})
.parse(None, Some(context))
Expand Down Expand Up @@ -306,10 +304,7 @@ mod tests {
only_with_files = false
})
.collect();
let expected = Some(format!(
"via {} ",
Color::Blue.bold().paint("🐳 ")
));
let expected = None;

assert_eq!(expected, actual);

Expand Down

0 comments on commit aa8a374

Please sign in to comment.