This repository was archived by the owner on Nov 20, 2023. It is now read-only.
File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,8 @@ public static void KillProcess(int pid)
144
144
{
145
145
try
146
146
{
147
- Process . GetProcessById ( pid ) ? . Kill ( ) ;
147
+ using var process = Process . GetProcessById ( pid ) ;
148
+ process ? . Kill ( ) ;
148
149
}
149
150
catch ( ArgumentException ) { }
150
151
catch ( InvalidOperationException ) { }
Original file line number Diff line number Diff line change @@ -332,8 +332,8 @@ private void WriteReplicaToStore(string pid)
332
332
333
333
private static string ? GetDotnetRoot ( )
334
334
{
335
- var process = Process . GetCurrentProcess ( ) ;
336
- var entryPointFilePath = process . MainModule . FileName ;
335
+ var entryPointFilePath = GetEntryPointFilePath ( ) ;
336
+
337
337
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) &&
338
338
Path . GetFileNameWithoutExtension ( entryPointFilePath ) == "dotnet" )
339
339
{
@@ -347,6 +347,12 @@ private void WriteReplicaToStore(string pid)
347
347
return null ;
348
348
}
349
349
350
+ private static string GetEntryPointFilePath ( )
351
+ {
352
+ using var process = Process . GetCurrentProcess ( ) ;
353
+ return process . MainModule . FileName ;
354
+ }
355
+
350
356
private class ProcessInfo
351
357
{
352
358
You can’t perform that action at this time.
0 commit comments