Skip to content

Correct handling of explicit -Since:$false parameter value in Get-Uptime#26141

Merged
iSazonov merged 4 commits intoPowerShell:masterfrom
logiclrd:get-uptime-since-explicit-false
Oct 9, 2025
Merged

Correct handling of explicit -Since:$false parameter value in Get-Uptime#26141
iSazonov merged 4 commits intoPowerShell:masterfrom
logiclrd:get-uptime-since-explicit-false

Conversation

@logiclrd
Copy link
Copy Markdown
Contributor

@logiclrd logiclrd commented Oct 3, 2025

Fix Get-Uptime's handling of -Since to check the switch's value, rather than only its presence, allowing parameter values to be passed through easily.

PR Summary

This PR adds a test to reproduce the bug described in issue #25015, and then updates the implementation of the Get-Uptime cmdlet to fix the bug, making the test pass.

PR Context

Fixes #25015
Related to #25242

PR Checklist

…ducing the bug described in issue PowerShell#25015.

Updated the implementation in GetUptime.cs to correct the handling of explicit $false values passed to -Since, making the test pass.
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 3, 2025
@logiclrd logiclrd mentioned this pull request Oct 5, 2025
12 tasks
Co-authored-by: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
Co-authored-by: xtqqczze <45661989+xtqqczze@users.noreply.github.com>
@xtqqczze
Copy link
Copy Markdown
Contributor

xtqqczze commented Oct 5, 2025

By the way, I noticed we could use Environment.TickCount64 instead of Stopwatch. Since #26151 is a full refactoring, let’s keep this PR focused on addressing #25015.

@logiclrd
Copy link
Copy Markdown
Contributor Author

logiclrd commented Oct 6, 2025

By the way, I noticed we could use Environment.TickCount64 instead of Stopwatch. Since #26151 is a full refactoring, let’s keep this PR focused on addressing #25015.

Let me know if there are any other adjustments needed.

@iSazonov iSazonov self-assigned this Oct 8, 2025
@iSazonov iSazonov enabled auto-merge (squash) October 8, 2025 04:06
@xtqqczze
Copy link
Copy Markdown
Contributor

xtqqczze commented Oct 8, 2025

@iSazonov Auto-merge isn’t triggering, is this because the PowerShell-Windows-Packaging-CI and PowerShell-CI-linux-packaging checks are still pending?

@iSazonov
Copy link
Copy Markdown
Collaborator

iSazonov commented Oct 9, 2025

/azp run PowerShell-Windows-Packaging-CI, PowerShell-CI-linux-packaging

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@iSazonov iSazonov merged commit e562d3f into PowerShell:master Oct 9, 2025
36 checks passed
@iSazonov iSazonov added Hacktoberfest Potential candidate to participate in Hacktoberfest Hacktoberfest-Accepted Accepted to participate in Hacktoberfest labels Oct 9, 2025
@xtqqczze
Copy link
Copy Markdown
Contributor

xtqqczze commented Oct 9, 2025

/azp run PowerShell-Windows-Packaging-CI, PowerShell-CI-linux-packaging

@iSazonov I wonder why these checks do not run automatically.

@logiclrd
Copy link
Copy Markdown
Contributor Author

logiclrd commented Oct 9, 2025

I wonder why these checks do not run automatically.

Related to this, perhaps?

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

So on the one hand, it's waiting for those pipelines to fire a completion event, but on the other end, the trigger to start the pipelines is filtered out by a path exclusion, and the requirement for successful completion doesn't factor that in so it's just waiting forever? I could be completely off-base, but that does seem to explain the observations.

@iSazonov
Copy link
Copy Markdown
Collaborator

There are MSFT compliance requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log Hacktoberfest Potential candidate to participate in Hacktoberfest Hacktoberfest-Accepted Accepted to participate in Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get-Uptime -Since ignores an explicit $false value

3 participants