Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Stop-Computer, Restart-Computer on macOS: support graceful shutdown by default, implement -Force support #19791

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Summary of the new feature / enhancement

Note:


A fix for #19738 is being worked on in #19780, and it will delegate to /sbin/shutdown -h now (shutdown) and /sbin/shutdown -r now (reboot) on macOS.

However, these commands amount to a forced shutdown: they do not afford GUI applications enough time to shut down gracefully, such as browsers and VM software, inducing potential data loss.

Therefore, I propose the following:

Proposed technical implementation details (optional)

By default, use the following commands on macOS - they do shut down gracefully, but - as on Windows - do not guarantee a shutdown, if an app refuses to quit:

  • Shutdown:
    • osascript -e 'tell application "System Events" to shut down'
  • Reboot:
    • osascript -e 'tell application "System Events" to restart'

Use /sbin/shutdown ONLY if -Force is specified.

  • Shutdown:
    • /sbin/shutdown -h now
  • Reboot:
    • /sbin/shutdown -r now

Note that the "graceful" commands do not require sudo, i.e. administrative privileges, whereas /sbin/shutdown always does.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugKeepOpenThe bot will ignore these and not auto-closeThe bot will ignore these and not auto-closeUp-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-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-ReviewedA Working Group has reviewed this and made a recommendationA Working Group has reviewed this and made a recommendation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Reviewed
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.