-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
On Unix-like platforms, Stop-Computer doesn'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
| Arguments = string.Empty, |
This causes Stop-Computer to malfunction on macOS, which requires -h now in oder to initiate an immediate shutdown, rendering Stop-Computer useless on macOS.
# !! Currently doesn't work on macOS.
sudo pwsh -NoProfile -Command Stop-ComputerAs 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
-WhatIf -
An 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 shutdown call fails due to missing options and prints its usage message:
usage: shutdown [-] [-h [-u] [-n] | -r [-n] | -s | -k] time [warning-message ...]
Error details
No response
Environment data
PowerShell 7.4.0-preview.3 on macOS 13.3.1Visuals
No response