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

Commit

Permalink
Bug fix - everyRun hook not being executed when there are no arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Apr 17, 2022
1 parent e57f032 commit c8da1a4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Squirrel/SquirrelAwareApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public static void HandleEvents(
{
SquirrelHook defaultBlock = ((v, t) => { });
var args = arguments ?? Environment.GetCommandLineArgs().Skip(1).ToArray();
if (args.Length == 0) return;

var fastExitlookup = new[] {
new { Key = "--squirrel-install", Value = onInitialInstall ?? defaultBlock },
Expand All @@ -81,7 +80,7 @@ public static void HandleEvents(
um.Dispose();

// in the fastExitLookup arguments, we run the squirrel hook and then exit the process
if (fastExitlookup.ContainsKey(args[0]) && args.Length >= 2) {
if (args.Length >= 2 && fastExitlookup.ContainsKey(args[0])) {
var version = new SemanticVersion(args[1]);
try {
fastExitlookup[args[0]](version, um);
Expand All @@ -93,7 +92,7 @@ public static void HandleEvents(
}

// otherwise we execute the 'everyrun' hook with the firstRun parameter.
bool firstRun = args[0] == "--squirrel-firstrun";
bool firstRun = args.Length >= 1 && args[0] == "--squirrel-firstrun";
onEveryRun?.Invoke(um.CurrentlyInstalledVersion(), um, firstRun);
}
}
Expand Down

0 comments on commit c8da1a4

Please sign in to comment.