Make template package uninstallation detection report errors properly
This commit is contained in:
parent
cb500fe3b8
commit
148e4af837
|
|
@ -74,23 +74,19 @@ namespace Templates.Test.Helpers
|
|||
// Verify we really did remove the previous templates
|
||||
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString("D"));
|
||||
Directory.CreateDirectory(tempDir);
|
||||
try
|
||||
|
||||
var proc = ProcessEx.Run(
|
||||
output,
|
||||
tempDir,
|
||||
"dotnet",
|
||||
$"new \"{templateName}\"");
|
||||
proc.WaitForExit(assertSuccess: false);
|
||||
if (!proc.Error.Contains($"No templates matched the input template name: {templateName}."))
|
||||
{
|
||||
var proc = ProcessEx.Run(
|
||||
output,
|
||||
tempDir,
|
||||
"dotnet",
|
||||
$"new \"{templateName}\"");
|
||||
proc.WaitForExit(assertSuccess: false);
|
||||
if (!proc.Error.Contains($"No templates matched the input template name: {templateName}."))
|
||||
{
|
||||
throw new InvalidOperationException($"Failed to uninstall previous templates. The template '{templateName}' could still be found.");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
Directory.Delete(tempDir);
|
||||
throw new InvalidOperationException($"Failed to uninstall previous templates. The template '{templateName}' could still be found.");
|
||||
}
|
||||
|
||||
Directory.Delete(tempDir);
|
||||
}
|
||||
|
||||
private static string FindAncestorDirectoryContaining(string filename)
|
||||
|
|
|
|||
Loading…
Reference in New Issue