Severity: Info
File: tests/Servy.Core.UnitTests/Helpers/ProcessKillerTests.cs lines 23–30
Description:
The test-class Dispose method iterates child cmd.exe processes to clean up test-spawned shells, but the body of the conditional is empty:
foreach (var p in Process.GetProcessesByName("cmd"))
{
// Only kill cmd processes that were likely spawned by these tests
if (p.MainWindowTitle == "" && p.SessionId == Process.GetCurrentProcess().SessionId)
{
// Careful here; usually safe in CI environments
}
}
The comment ("Careful here; usually safe in CI environments") indicates someone started writing the kill path and then backed off. Either the intended cleanup was never finished (orphan cmd.exe processes survive test runs) or the guard was deliberately removed and the foreach should now be deleted.
Suggested fix:
Decide between the two outcomes and make it explicit:
- If the kill is wanted: add
try { p.Kill(); } catch { /* ignore */ } finally { p.Dispose(); } inside the if.
- If it is not: remove the dead
foreach and its comment so the file stops inviting the question.
Whichever path is chosen, dispose the iterated Process instances (the first foreach on line 19 also leaks the iterated processes — each one needs p.Dispose()).
Severity: Info
File:
tests/Servy.Core.UnitTests/Helpers/ProcessKillerTests.cslines 23–30Description:
The test-class
Disposemethod iterates childcmd.exeprocesses to clean up test-spawned shells, but the body of the conditional is empty:The comment (
"Careful here; usually safe in CI environments") indicates someone started writing the kill path and then backed off. Either the intended cleanup was never finished (orphancmd.exeprocesses survive test runs) or the guard was deliberately removed and theforeachshould now be deleted.Suggested fix:
Decide between the two outcomes and make it explicit:
try { p.Kill(); } catch { /* ignore */ } finally { p.Dispose(); }inside theif.foreachand its comment so the file stops inviting the question.Whichever path is chosen, dispose the iterated
Processinstances (the firstforeachon line 19 also leaks the iterated processes — each one needsp.Dispose()).