Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Fix _log is null in Update.exe
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Jun 8, 2022
1 parent d20cbbe commit 34fbcad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Update.Windows/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Squirrel.SimpleSplat;
using Squirrel.SimpleSplat;
using Squirrel.Json;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -44,18 +44,18 @@ static int main(string[] args)
try {
opt = new StartupOption(args);
} catch (Exception ex) {
_log = new SetupLogLogger(UpdateAction.Unset);
_log.Write($"Failed to parse command line options. {ex.Message}", LogLevel.Error);
var logger = new SetupLogLogger(UpdateAction.Unset);
logger.Write($"Failed to parse command line options. {ex.Message}", LogLevel.Error);
throw;
}

var logger = new SetupLogLogger(opt.updateAction);
SquirrelLocator.CurrentMutable.Register(() => logger, typeof(ILogger));
_log = new SetupLogLogger(opt.updateAction);
SquirrelLocator.CurrentMutable.Register(() => _log, typeof(ILogger));

try {
return executeCommandLine(args);
} catch (Exception ex) {
logger.Write("Finished with unhandled exception: " + ex, LogLevel.Fatal);
_log.Write("Finished with unhandled exception: " + ex, LogLevel.Fatal);
throw;
}
}
Expand Down

0 comments on commit 34fbcad

Please sign in to comment.