Harden docker detection (#2552)

This commit is contained in:
BrennanConroy 2018-06-28 09:31:42 -07:00 committed by GitHub
parent bc8aae5d50
commit bafde7738f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -37,15 +37,12 @@ namespace Microsoft.AspNetCore.SignalR.Redis.Tests
var docker = new Docker(location);
// Windows docker must have Linux containers turned on, if they don't skip the docker tests
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
docker.RunCommand("info --format '{{.OSType}}'", out var output);
docker.RunCommand("info --format '{{.OSType}}'", out var output);
if (!string.Equals(output, "linux"))
{
return null;
}
if (!string.Equals(output.Trim('\'', '"', '\r', '\n', ' '), "linux"))
{
Console.WriteLine($"'docker info' output: {output}");
return null;
}
return docker;