-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add an implementation of Stop-Computer for Linux and macOS
#11151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
55c7dbb to
db7bb30
Compare
|
I'm pretty sure the Windows CI run is a flake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't prevent cross compilation. Pass in the property from the build.psm1. You can then default the property if it is not set from the commandline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example:
PowerShell/PowerShell.Common.props
Line 115 in c17d5a7
| <IsWindows Condition="'$(IsWindows)' =='true' or ( '$(IsWindows)' == '' and '$(OS)' == 'Windows_NT')">true</IsWindows> |
Line 347 in c17d5a7
| $Arguments += "/property:IsWindows=true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed to be a runtime thing.
TravisEz13
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason start-process won't work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean the C# Process class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, here is an example:
PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/Clipboard.cs
Line 19 in 9851b07
| private static string StartProcess( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-P is not an option on the macOS shutdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we handle it when the user doesn't have permissions to shutdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command will error out and we (now) write the error code to the stream.
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
|
@brendandburns I had the CI system rerun the flaky tests and filed: #11168 |
PaulHigin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. I would like to see Restart-Computer also be enabled for non-Windows platforms.
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
8afdfc1 to
1be3fb8
Compare
|
Comments addressed, please re-check. |
90c6695 to
919fc84
Compare
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
|
comments addressed, please take another look. |
PaulHigin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs
Outdated
Show resolved
Hide resolved
|
@SteveL-MSFT comments addressed, please take another look. Thanks! |
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@TravisEz13 any chance you can take another look here, I'd love to see this merged since I have a follow up PR to share once it is merged. |
|
@brendandburns Sorry, I've been out of the office. |
Stop-Computer for Linux and macOS
|
🎉 Handy links: |
PR Summary
Adds an implementation of the Stop-Computer cmdlet for Linux and OS X
PR Context
Closes #5448
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.