Skip to content

Add an implementation of Stop-Computer for Linux and macOS - #11151

Merged
Travis Plunk (TravisEz13) merged 1 commit into
PowerShell:masterfrom
brendandburns:stop
Dec 3, 2019
Merged

Add an implementation of Stop-Computer for Linux and macOS#11151
Travis Plunk (TravisEz13) merged 1 commit into
PowerShell:masterfrom
brendandburns:stop

Conversation

@brendandburns

@brendandburns Brendan Burns (brendandburns) commented Nov 22, 2019

Copy link
Copy Markdown
Contributor

PR Summary

Adds an implementation of the Stop-Computer cmdlet for Linux and OS X

PR Context

Closes #5448

PR Checklist

@brendandburns

Copy link
Copy Markdown
Contributor Author

I'm pretty sure the Windows CI run is a flake.

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example:

<IsWindows Condition="'$(IsWindows)' =='true' or ( '$(IsWindows)' == '' and '$(OS)' == 'Windows_NT')">true</IsWindows>

$Arguments += "/property:IsWindows=true"

Copy link
Copy Markdown
Contributor Author

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 Travis Plunk (TravisEz13) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 22, 2019

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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.

@TravisEz13

Copy link
Copy Markdown
Member

Brendan Burns (@brendandburns) I had the CI system rerun the flaky tests and filed: #11168

Copy link
Copy Markdown
Contributor

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.

Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 25, 2019
@brendandburns

Copy link
Copy Markdown
Contributor Author

Comments addressed, please re-check.

@brendandburns

Copy link
Copy Markdown
Contributor Author

comments addressed, please take another look.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
Comment thread src/Microsoft.PowerShell.Commands.Management/commands/management/ComputerUnix.cs Outdated
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 26, 2019
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 27, 2019
@brendandburns

Copy link
Copy Markdown
Contributor Author

Steve Lee (@SteveL-MSFT) comments addressed, please take another look.

Thanks!

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brendandburns

Copy link
Copy Markdown
Contributor Author

Travis Plunk (@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.

@TravisEz13

Copy link
Copy Markdown
Member

Brendan Burns (@brendandburns) Sorry, I've been out of the office.

@TravisEz13 Travis Plunk (TravisEz13) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Dec 3, 2019
@TravisEz13 Travis Plunk (TravisEz13) changed the title Add an implementation of Stop-Computer for Linux and OS X. Add an implementation of Stop-Computer for Linux and macOS Dec 3, 2019
@TravisEz13
Travis Plunk (TravisEz13) merged commit d38541f into PowerShell:master Dec 3, 2019
@ghost

Copy link
Copy Markdown

🎉v7.1.0-preview.1 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Stop-Computer cmdlet

4 participants