-
Notifications
You must be signed in to change notification settings - Fork 905
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
(GH-8) Host PowerShell #524
Merged
ferventcoder
merged 9 commits into
chocolatey:stable
from
ferventcoder:ticket/posh-runner
Jan 1, 2016
Merged
(GH-8) Host PowerShell #524
ferventcoder
merged 9 commits into
chocolatey:stable
from
ferventcoder:ticket/posh-runner
Jan 1, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement a Console.ReadLine with a timeout so that when confirmation is selected it doesn't block the thread eternally. This allows folks to put prompts in chocolatey automation scripts with a default selection and other fun prompting actions.
Implement Execute.with_timeout.command chain. This allows running commands with timeouts, so that the CommandExecution timeout can be observed.
Similar to ReadLine timeout, implement a readkey with an optional timeout so that a process will block only for a limited amount of time before failing when running actions that require user input.
Add extension for converting a string to a SecureString. This should return an empty securestring if the value passed in is null or empty.
Add SMA and reference it appropriately. Through research it has been found to take a dependency on the v1 version of SMA and set the reference in the visual studio projects to not use a specific version and not copy it local. This means it depends on being available in the GAC, which should be if .NET Framework 4+ is installed. The reference to v1 allows it to work across all versions of Windows that have at least PowerShell v2 installed.
Implement a custom PowerShell host. This allows for the following: * Read-Host timeouts when running with confirm prompts so that the host doesn't block forever. It also allows the default to automatically be selected. * ReadKey timeouts when running with confirm prompts. * Write-* values all get logged with the choco log all in the proper location instead of needing to parse the values to determine which log they should go to. * Write-Progress shows up inline.
By default use the internal PowerShell host. Allow using the system host either by shutting off the feature or by using a switch `--use-system-powershell`.
When running PowerShell operations, use a built-in PowerShell host by default, allowing fallback to the older method of running Posh by calling an external process. By building against the oldest version of System.Management.Automation that aligns with the oldest Windows Operating Systems supported, we can guarantee this will work on every version of Windows where Chocolatey is supported. In case we do run into issues, attempt to resolve the PowerShell assemblies starting from the newest version and falling down to the older versions until one is resolved or no version is resolved. There is a known assembly that will go through this process every time - System.Management.Automation.resources, en-US. To see those assemblies go through, one must ask for both debug and verbose output. This reverts the changes for chocolateyGH-249 in 9936876 and the changes from chocolateyGH-349 in 344268b so that both paths (system powershell and choco's built-in PowerShell) run with similar output and because by default in d523e7b (chocolateyGH-445) choco no longer fails on the presence of stderr output.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #517.
Closes #8