Skip to content

Commit

Permalink
(chocolateyGH-349) Ignore PowerShell InitializeDefaultDrives
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ferventcoder committed Sep 18, 2015
1 parent d5dd42f commit 344268b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 344268b

Please sign in to comment.