Skip to content

Fix #2555: Should-BeNull treats empty pipeline input as null#2689

Draft
nohwnd wants to merge 1 commit intopester:mainfrom
nohwnd:fix-2555-shouldbenull
Draft

Fix #2555: Should-BeNull treats empty pipeline input as null#2689
nohwnd wants to merge 1 commit intopester:mainfrom
nohwnd:fix-2555-shouldbenull

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented Apr 3, 2026

Fix #2555

When a function returns no output and the result is piped to Should-BeNull, PowerShell sends an empty array through the pipeline. Should-BeNull now recognizes this as no output and treats it as null.

  • Pipeline empty array: passes (void function output)
  • Explicit parameter empty array: still fails

Copilot-generated fix.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

When a function returns no output and the result is piped to Should-BeNull,
PowerShell sends an empty array through the pipeline. Should-BeNull now
recognizes this as no output and treats it as null.

- Pipeline empty array: passes (void function output)
- Explicit parameter empty array: still fails

Copilot-generated fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Should-BeNull: Strange behaviour when $null

1 participant