launch error display

This commit is contained in:
Nathan
2025-12-17 17:18:27 -07:00
parent 84a518a9c9
commit 188d74c072
7 changed files with 21351 additions and 19 deletions

View File

@@ -275,10 +275,28 @@ namespace UnifiedFarmLauncher.Services
if (process.ExitCode != 0 && !interactive)
{
throw new InvalidOperationException($"SSH script execution failed with exit code {process.ExitCode}: {error}");
var errorText = error.ToString();
var combinedOutput = output.ToString();
if (!string.IsNullOrWhiteSpace(errorText))
{
combinedOutput = string.IsNullOrWhiteSpace(combinedOutput)
? errorText
: $"{combinedOutput}\n\n=== STDERR ===\n{errorText}";
}
throw new InvalidOperationException($"SSH script execution failed with exit code {process.ExitCode}: {combinedOutput}");
}
return output.ToString();
// Include stderr in output if present (for diagnostics)
var result = output.ToString();
var stderrText = error.ToString();
if (!string.IsNullOrWhiteSpace(stderrText) && !interactive)
{
result = string.IsNullOrWhiteSpace(result)
? stderrText
: $"{result}\n\n=== STDERR ===\n{stderrText}";
}
return result;
}
public async Task<string> GetWorkerBasePathAsync(WorkerConfig worker)