Update GetProcessByUsedTcpPort (Fix #591)

This commit is contained in:
ChsBuffer
2021-03-23 16:14:34 +08:00
parent 8e545fc05f
commit 8269948288
2 changed files with 12 additions and 2 deletions

View File

@@ -193,7 +193,17 @@ namespace Netch.Controllers
{
foreach (var p in PortHelper.GetProcessByUsedTcpPort(port))
{
if (p.MainModule!.FileName.StartsWith(Global.NetchDir))
try
{
_ = p.MainModule!.FileName;
}
catch (Exception e)
{
Logging.Warning(e.ToString());
continue;
}
if (p.MainModule.FileName.StartsWith(Global.NetchDir))
{
p.Kill();
p.WaitForExit();