Severity: Info
File: src/Servy.Service/ProcessManagement/ProcessLauncher.cs, lines 64-94
The FireAndForget early return is duplicated. The first check at lines 65-68 returns before any buffer setup runs; the second identical check at lines 90-94 (with the same // 6. Handle execution mode comment) can never be true because options is not mutated between the two checks — it is unreachable dead code.
// 6. Handle execution mode
if (options.FireAndForget)
{
return process;
}
var stdoutBuffer = new StringBuilder();
var stderrBuffer = new StringBuilder();
if (psi.RedirectStandardOutput)
{
process.UnderlyingProcess.OutputDataReceived += (_, e) =>
{
if (e.Data != null)
stdoutBuffer.AppendLine(e.Data);
};
}
if (psi.RedirectStandardError)
{
process.UnderlyingProcess.ErrorDataReceived += (_, e) =>
{
if (e.Data != null)
stderrBuffer.AppendLine(e.Data);
};
}
// 6. Handle execution mode
if (options.FireAndForget)
{
return process;
}
if (psi.RedirectStandardOutput) process.BeginOutputReadLine();
if (psi.RedirectStandardError) process.BeginErrorReadLine();
Suggested fix
Delete lines 90-94 (the duplicate check and its comment). The early return at lines 65-68 is sufficient.
Severity: Info
File:
src/Servy.Service/ProcessManagement/ProcessLauncher.cs, lines 64-94The
FireAndForgetearly return is duplicated. The first check at lines 65-68 returns before any buffer setup runs; the second identical check at lines 90-94 (with the same// 6. Handle execution modecomment) can never be true becauseoptionsis not mutated between the two checks — it is unreachable dead code.Suggested fix
Delete lines 90-94 (the duplicate check and its comment). The early return at lines 65-68 is sufficient.