Skip to content

Commit

Permalink
fix can kill
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Nov 20, 2020
1 parent b36b914 commit cbfe674
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/DiffEngine/DiffRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ static async Task<LaunchResult> InnerLaunchAsync(TryResolveTool tryResolveTool,

tool.CommandAndArguments(tempFile, targetFile, out var arguments, out var command);

var canKill = !tool.IsMdi;
if (ProcessCleanup.TryGetProcessInfo(command, out var processCommand))
{
if (tool.AutoRefresh)
{
await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, tool.IsMdi!, processCommand.Process);
await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, canKill, processCommand.Process);
return LaunchResult.AlreadyRunningAndSupportsRefresh;
}

Expand All @@ -159,13 +160,13 @@ static async Task<LaunchResult> InnerLaunchAsync(TryResolveTool tryResolveTool,

if (MaxInstance.Reached())
{
await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, tool.IsMdi!, null);
await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, canKill, null);
return LaunchResult.TooManyRunningDiffTools;
}

var processId = LaunchProcess(tool, arguments);

await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, !tool.IsMdi, processId);
await DiffEngineTray.AddMoveAsync(tempFile, targetFile, tool.ExePath, arguments, canKill, processId);

return LaunchResult.StartedNewInstance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649</NoWarn>
<Version>6.4.4</Version>
<Version>6.4.5</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>
Expand Down

0 comments on commit cbfe674

Please sign in to comment.