Fallout-build / Fallout-build/Fallout
`--help` crashes with IOException when stdout has no console handle
- Dominant language
- C#
- Stars
- 154
- Forks
- 19
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 15
Description
@
## Problem
`HandleHelpRequestsAttribute` reads `Console.BufferWidth` directly, so any `--help` invocation where the process has no console buffer (redirected stdout, pipe, CI, IDE output pane) throws instead of printing help. The target list prints, then the run hard-fails.
`src/Fallout.Build/Execution/Extensions/HandleHelpRequestsAttribute.cs:62`:
```csharp
if (nextLength >= Console.BufferWidth || nextLength > 90)
```
Repro — migrated consumer repo (FluentAssertions at its last NUKE commit), `Fallout.Common` 10.4.0-rc.5:
```
./build.ps1 --help > log.txt 2>&1
```
```
System.IO.IOException: The handle is invalid.
at System.ConsolePal.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.Console.get_BufferWidth()
at HandleHelpRequestsAttribute...SplitLines|3(String text) HandleHelpRequestsAttribute.cs:line 62
at HandleHelpRequestsAttribute.GetParametersText() HandleHelpRequestsAttribute.cs:line 90
at HandleHelpRequestsAttribute.OnBuildInitialized(...) HandleHelpRequestsAttribute.cs:line 20
at BuildManager.Execute[T](...) BuildManager.cs:line 68
```
Affects **both `main` and `release/v10.4`** — the call site is identical on each.
Note the codebase already has the right abstraction (`ConsoleUtility` → `ConsoleWrapper.BufferWidth`), but `SystemConsole.BufferWidth` also calls `Console.BufferWidth` unguarded — so switching to the wrapper alone does not fix this.
## Outcome
`--help` prints usable help regardless of whether a console is attached.
## Acceptance criteria
- [ ] `--help` succeeds with stdout redirected to a file and through a pipe
- [ ] Width falls back to a sane default (the existing `90` clamp) when no console buffer is available
- [ ] `SystemConsole.BufferWidth` guards on `Console.IsOutputRedirected` rather than throwing
- [ ] Regression test covers the redirected-stdout path
- [ ] Backported to `release/v10.4`
@
Contributor guide
Assessment
This issue has not been assessed yet.