Skip to content

Scope stdout-safe warning suppression to non-interactive sessions only - #21

Merged
jpol34 merged 1 commit into
mainfrom
scope-warning-suppression
Sep 16, 2026
Merged

jpol34 merged 1 commit into
mainfrom
scope-warning-suppression

Conversation

@jpol34

@jpol34 jpol34 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Follow-up to #20 (code-review findings after that PR was already merged).

Summary

  • Suppress warning-stream ANSI output contaminating strongbox get's stdout #20 set `$WarningPreference = 'SilentlyContinue'` for every invocation of `bin/strongbox.ps1`, which also silences legitimate warnings for a human at a real terminal - the ANSI-on-stdout contamination it fixes only happens when stdout is redirected (SSH, a shell script), not interactively.
  • Moved `Test-InteractiveTerminal` earlier in the file (previously only defined later, for `Assert-RevealAllowed`) and gated the suppression on it - matching the same interactive/non-interactive distinction `--real` already draws elsewhere in this file.
  • Reworded the comment to state the current invariant instead of narrating the bug's history, per this repo's doc-comment discipline.

Test plan

  • 43/43 Pester tests pass
  • Confirmed on the Pi: `strongbox get POSTGRES_USER --real` still returns clean bytes (no ANSI) in a non-interactive SSH session

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGra6GqN8qAxEDHbhmJwP2

Follow-up to #20: that fix set \$WarningPreference = 'SilentlyContinue' for
every invocation, which also silences legitimate warnings for a human typing
at a real terminal - the contamination bug it fixes only manifests when
stdout is redirected (SSH, a shell script), not interactively. Moved
Test-InteractiveTerminal earlier in the file (was only defined later, for
Assert-RevealAllowed) and gated the suppression on it, matching the same
interactive/non-interactive distinction --real already draws. Also reworded
the comment to state the current invariant instead of narrating the bug's
history, per doc-comment discipline.

Verified: 43/43 Pester tests pass; confirmed on the Pi that
`strongbox get POSTGRES_USER --real` still returns clean bytes non-interactively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGra6GqN8qAxEDHbhmJwP2
@jpol34
jpol34 merged commit 03821a4 into main Sep 16, 2026
1 check passed
@jpol34
jpol34 deleted the scope-warning-suppression branch September 16, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant