Skip to content

Stop-Computer: broken on macOS; suboptimal UX on all Unix-like platforms #19738

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

On Unix-like platforms, Stop-Computer doesn't support arguments and simply invokes /sbin/shutdown - ultimately argument-less - see:

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-Computer

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 -WhatIf

  • An attempt to pass arguments through to shutdown fails, 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.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIssue has been identified as a bug in the productNeeds-TriageThe issue is new and needs to be triaged by a work group.OS-macOSWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management moduleWG-DevEx-Portabilityauthoring cross-platform or cross-architecture modules, cmdlets, and scripts

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions