Skip to content

Commit

Permalink
(GH-7) Do not error on removing choco.exe.old
Browse files Browse the repository at this point in the history
It could be that there are two running instances of choco going at the
same time during upgrade scenarios, so throwing a fatal error
would be a bad thing.
  • Loading branch information
ferventcoder committed Feb 4, 2015
1 parent 51d59c8 commit ecd1512
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,15 @@ private static void Main(string[] args)

private static void remove_old_chocolatey_exe(IFileSystem fileSystem)
{
fileSystem.delete_file(Assembly.GetExecutingAssembly().Location + ".old");
fileSystem.delete_file(fileSystem.combine_paths(AppDomain.CurrentDomain.BaseDirectory, "choco.exe.old"));
try
{
fileSystem.delete_file(Assembly.GetExecutingAssembly().Location + ".old");
fileSystem.delete_file(fileSystem.combine_paths(AppDomain.CurrentDomain.BaseDirectory, "choco.exe.old"));
}
catch (Exception ex)
{
"chocolatey".Log().Warn("Attempting to delete choco.exe.old ran into an issue:{0} {1}".format_with(Environment.NewLine,ex.Message));
}
}

private static void pause_execution_if_debug()
Expand Down

0 comments on commit ecd1512

Please sign in to comment.