From 344268b4bed973b10aa14b7cf1b7ccef2e197fd8 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 17 Sep 2015 22:23:07 -0500 Subject: [PATCH] (GH-349) Ignore PowerShell InitializeDefaultDrives If you have a network drive that is not available or has been disconnected, PowerShell will happily throw an error about it with the following message: "Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed." Since it is not really an error, we should log the message accordingly and move on, but not fail the choco install due to some crazy warning that for some reason is an error message. --- .../infrastructure.app/services/PowershellService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index abaeb51cbd..44d3937686 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -32,6 +32,7 @@ public class PowershellService : IPowershellService private readonly IFileSystem _fileSystem; private readonly string _customImports; private const string OPERATION_COMPLETED_SUCCESSFULLY = "The operation completed successfully."; + private const string INITIALIZE_DEFAULT_DRIVES = "Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed."; public PowershellService(IFileSystem fileSystem) : this(fileSystem, new CustomString(string.Empty)) @@ -275,7 +276,7 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack (s, e) => { if (string.IsNullOrWhiteSpace(e.Data)) return; - if (e.Data.is_equal_to(OPERATION_COMPLETED_SUCCESSFULLY)) + if (e.Data.is_equal_to(OPERATION_COMPLETED_SUCCESSFULLY) || e.Data.is_equal_to(INITIALIZE_DEFAULT_DRIVES)) { this.Log().Info(() => " " + e.Data); }