-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Stop-Computer: broken on macOS; suboptimal UX on all Unix-like platforms #19738
Copy link
Copy link
Open
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.OS-macOSWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-DevEx-Portabilityauthoring cross-platform or cross-architecture modules, cmdlets, and scriptsauthoring cross-platform or cross-architecture modules, cmdlets, and scripts
Metadata
Metadata
Assignees
Labels
Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.OS-macOSWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-DevEx-Portabilityauthoring cross-platform or cross-architecture modules, cmdlets, and scriptsauthoring cross-platform or cross-architecture modules, cmdlets, and scripts
Prerequisites
Steps to reproduce
On Unix-like platforms,
Stop-Computerdoesn't support arguments and simply invokes/sbin/shutdown- ultimately argument-less - see:PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Line 162 in 0355d2f
This causes
Stop-Computerto malfunction on macOS, which requires-h nowin oder to initiate an immediate shutdown, renderingStop-Computeruseless on macOS.As for the suboptimal UX, which applies to all Unix-like platforms:
The syntax diagram shows the Windows-only parameters.
Tab-completion completes the common parameters (only), even though they are useless.
Common parameters are accepted, but effectively ignored, which is especially treacherous with
-WhatIfAn attempt to pass arguments through to
shutdownfails, but with a nondescript error message (A parameter cannot be found) - a specific message indicating that pass-through arguments aren't supported would be more helpful.Expected behavior
An immediate shutdown should be initiated.
Actual behavior
The
shutdowncall fails due to missing options and prints its usage message:Error details
No response
Environment data
Visuals
No response