Skip to content
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

Use Internal PowerShell Host #8

Closed
ferventcoder opened this issue Jan 11, 2015 · 0 comments
Closed

Use Internal PowerShell Host #8

ferventcoder opened this issue Jan 11, 2015 · 0 comments

Comments

@ferventcoder
Copy link
Member

ferventcoder commented Jan 11, 2015

This involves really designing the process and I have ideas in head for this one so restricting this to core team only.

Implement a custom PowerShell host. This allows for the following:

  • Read-Host, Prompt for Choice, etc times out 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 GH-249 in 9936876 and the changes
from GH-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 (GH-445) choco no longer fails on the
presence of stderr output.

@ferventcoder ferventcoder self-assigned this Jan 11, 2015
@ferventcoder ferventcoder changed the title [Enhancement] Switch posh runner to System.Automation [Core Team Only] Switch posh runner to System.Automation Jan 17, 2015
@ferventcoder ferventcoder changed the title [Core Team Only] Switch posh runner to System.Automation Switch posh runner to System.Automation Jan 17, 2015
@ferventcoder ferventcoder modified the milestone: 0.9.10 Jan 21, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Aug 18, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Aug 19, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Sep 15, 2015
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.
@ferventcoder ferventcoder modified the milestones: 0.9.10, 0.9.10.1 Oct 3, 2015
ferventcoder added a commit to ferventcoder/choco that referenced this issue Oct 8, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Oct 11, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Dec 23, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Dec 28, 2015
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
Implement Execute.with_timeout.command chain. This allows running
commands with timeouts, so that the CommandExecution timeout can be
observed.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
Add extension for converting a string to a SecureString. This should
return an empty securestring if the value passed in is null or empty.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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`.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 1, 2016
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.
@ferventcoder ferventcoder changed the title Switch posh runner to System.Automation Use Internal PowerShell Host Jan 1, 2016
ferventcoder added a commit that referenced this issue Jan 1, 2016
@ferventcoder ferventcoder modified the milestones: 0.9.10, 0.9.10.1 Jan 1, 2016
ferventcoder added a commit that referenced this issue Jan 1, 2016
* stable:
  (doc) update Changelog
  (GH-8) Use Custom PowerShell Host
  (GH-8) Configuration for PowerShell Host
  (GH-8) Implement Custom PowerShell Host
  (GH-8) Add System.Management.Automation binary
  (GH-8) Convert to SecureString
  (GH-8) ReadKey Timeout
  (GH-8) Run commands with timeout
  (maint) add messages to package installers
  (GH-8) ReadLine Timeout
  (GH-445) Scenario docs update
  (GH-520) Fix: Debug/Verbose messages not logged
ferventcoder added a commit that referenced this issue Jan 2, 2016
- In a terminating error, write the script stack trace if available
- If running with debug, output the stacktrace.
- Empty WriteLine() should write out an empty line in the log
- If the script times out, throw the cancellation token.
ferventcoder added a commit that referenced this issue Jan 2, 2016
As a continuation of GH-8, download progress should be written inline,
but needs some improvements:
- Write an empty line when it has completed so that the next log item
   doesn't write to the same line.
- Improve the content of the progress message with both percentage and
  the status message.
ferventcoder added a commit that referenced this issue Jan 2, 2016
* stable:
  (specs) start setting up host for executing specs
  (GH-525) Improve write-progress
  (GH-525) Improve Write-Progress
  (GH-8) PowerShell host execution improvements
ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 6, 2016
ferventcoder added a commit that referenced this issue Jan 10, 2016
* stable:
  (doc) update readme/contributing
  (GH-305) Assume NSIS if you've found uninst.exe
  (GH-8) escape curly braces for log formatting

# Conflicts:
#	CONTRIBUTING.md
ferventcoder added a commit to ferventcoder/choco that referenced this issue Feb 4, 2016
Our internal host uses our logging techniques, so we always want to
capture both Debug and Verbose output from PowerShell.
ferventcoder added a commit to ferventcoder/choco that referenced this issue Feb 4, 2016
* stable:
  (chocolateyGH-603) Get-FileName should set proxy if required
  (chocolateyGH-611) Fix - Verbose shows up on Debug
  (chocolateyGH-8) Always set Debug/Verbose for host
ferventcoder added a commit that referenced this issue Mar 14, 2016
Both the caption and the message should be displayed to users during
PowerShell prompting. The choices menu should look more similar to how
it would originally look in PowerShell.
ferventcoder added a commit that referenced this issue Mar 14, 2016
* stable:
  (GH-8) Refine Posh Prompting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants