-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Get-Uptime -Since ignores an explicit $false value #25015
Copy link
Copy link
Closed
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issuesWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation
Type
Projects
Status
Reviewed
Prerequisites
Steps to reproduce
Expected behavior
Actual behavior
Context
Get-Uptimeemits a[timespan]object by default or[datetime]with-Since.-Sinceis explicitly provided a$falsevalue (-Since:$false/hash table splatting), the type is unexpectedly[datetime].-Since/-Since:$trueand-Since:$falseresult in identical behavior.Get-Uptimeuses the selected parameter set to determine output type, which is tied to the presence of the-Sinceswitch, not its value.PowerShell/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUptime.cs
Lines 39 to 49 in df248bd
Despite it being uncommon to specify an explicit
$falseswitch (and arguably against its intention), I believe the currentGet-Uptimebehavior still amounts to a bug.$falseis permitted by the language and theGet-Uptimeresult subverts reasonable user expectation.$falsevalue (e.g.,'foo' | Select-String f -Raw:$false)Environment data