Compare commits
224 Commits
master
...
release/v7
Author | SHA1 | Date | |
---|---|---|---|
|
e7a4de5da4 | ||
|
e26717af2f | ||
|
081dff0e3d | ||
|
adf2729aaa | ||
|
28c6dd4aa5 | ||
|
733295b59a | ||
|
814feb6120 | ||
|
90b4504aac | ||
|
40c341c8f4 | ||
|
7c4fd5b29a | ||
|
17da21af20 | ||
|
2cc2d9c579 | ||
|
7d90d3f959 | ||
|
28000fa8e4 | ||
|
a447e4498d | ||
|
32e766aa3e | ||
|
cd753e616e | ||
|
252ba19ba6 | ||
|
395b941071 | ||
|
183e2411a5 | ||
|
e08f9eeeb6 | ||
|
f728e44c5b | ||
|
7c8152dafb | ||
|
84ff770ba7 | ||
|
2e14410d15 | ||
|
1aa4a36a5e | ||
|
ab0e9d58fa | ||
|
1c7ec2f582 | ||
|
8450602d59 | ||
|
9fc8642474 | ||
|
dd76e4721b | ||
|
510461f0f6 | ||
|
347dfa3ad1 | ||
|
20f62f4420 | ||
|
61465c9c6d | ||
|
8b780f2718 | ||
|
0413ffd2ab | ||
|
11af035aab | ||
|
8fcfe41978 | ||
|
a73ae1ad89 | ||
|
8ded9a8e45 | ||
|
ba4a71948a | ||
|
3ddd25fdd8 | ||
|
caede6fe99 | ||
|
4fd81ac0cf | ||
|
64c9f03acb | ||
|
5535e22345 | ||
|
9b022669b2 | ||
|
2a23f51bac | ||
|
0dcef011e4 | ||
|
bf9e56f1cc | ||
|
8b1e1f0518 | ||
|
e2e23e318d | ||
|
8306762644 | ||
|
b9296ad7ce | ||
|
e0ef892ce8 | ||
|
8d46305005 | ||
|
28514a7ac7 | ||
|
6254680453 | ||
|
07ca0cd99f | ||
|
38877e52ec | ||
|
ab878abfc9 | ||
|
14851187aa | ||
|
978d190594 | ||
|
205fe1308d | ||
|
4ad82b014a | ||
|
8259ed4903 | ||
|
e9bada725c | ||
|
6540a954dd | ||
|
b8602c8034 | ||
|
8753721320 | ||
|
5e182aca5a | ||
|
50ace4032a | ||
|
f47f40ff15 | ||
|
703702d879 | ||
|
17d19d95b3 | ||
|
119bd6d9b6 | ||
|
b73123033c | ||
|
c27239afdd | ||
|
6906f788fb | ||
|
5d4b1b760d | ||
|
eb2c4accdd | ||
|
56a6002a84 | ||
|
f153a64400 | ||
|
c446ba0e8b | ||
|
efd3c91b92 | ||
|
54497ba018 | ||
|
6caf475f55 | ||
|
d475414ef2 | ||
|
f432a77ab1 | ||
|
da96d2f7c6 | ||
|
d29f7a7035 | ||
|
3800e0cdef | ||
|
7a0eb645c7 | ||
|
0aad398b0e | ||
|
b29d5dc8db | ||
|
b124d1815d | ||
|
cf527b23d9 | ||
|
d8d1d788b8 | ||
|
f518f0bc4c | ||
|
ff8311ec60 | ||
|
896466b206 | ||
|
f1cb6d6b63 | ||
|
a3385b92e3 | ||
|
24acc42d9a | ||
|
72492008c6 | ||
|
30aa6c7d26 | ||
|
5c804e2445 | ||
|
0fe19c1136 | ||
|
580816a575 | ||
|
71843e7236 | ||
|
865394022e | ||
|
3cfa8eb258 | ||
|
8af2f5c611 | ||
|
0739d311e1 | ||
|
209dcc18e2 | ||
|
284e7a9fc9 | ||
|
0289c90bee | ||
|
960b751680 | ||
|
a2c0eba8b2 | ||
|
10230139bf | ||
|
472fcf1296 | ||
|
4790f2ee8f | ||
|
8da37f9005 | ||
|
4f25173d97 | ||
|
cfae544379 | ||
|
f3e89938a4 | ||
|
8ddeb47992 | ||
|
dd8638e741 | ||
|
4cdec35269 | ||
|
82b1e39f93 | ||
|
603ca22249 | ||
|
8124f2f9f6 | ||
|
00bab545dc | ||
|
5f2bfe1708 | ||
|
1a5b53a821 | ||
|
bd1dabf361 | ||
|
e9302fe82e | ||
|
3d0f7f0faf | ||
|
85bb6a0ff3 | ||
|
b12290eec0 | ||
|
2bbf08166f | ||
|
9027d1a433 | ||
|
a8f465d53c | ||
|
b238eaaad6 | ||
|
f1729f9cda | ||
|
00917b05f9 | ||
|
ea630d0b5a | ||
|
555dabe02e | ||
|
357c274a26 | ||
|
10aa268c9f | ||
|
ba6ad1a348 | ||
|
f1c0a0dacd | ||
|
7d44bd2f17 | ||
|
d1d92a35c3 | ||
|
d2626e6b1a | ||
|
f5381d5694 | ||
|
64ff0fc799 | ||
|
e6755c0f35 | ||
|
d1f8bd29ab | ||
|
7744b0aa24 | ||
|
06535b65ec | ||
|
89af531d33 | ||
|
4f19c4d6d3 | ||
|
ac30fcd388 | ||
|
5d47dd4f50 | ||
|
6cc82777e1 | ||
|
95a974701d | ||
|
80c5ddefa0 | ||
|
f85ff3a62e | ||
|
6d4febaa35 | ||
|
eeb0b2a9c5 | ||
|
b2615a3e1a | ||
|
c6e3f0e2a5 | ||
|
ab9bfcd0e7 | ||
|
c718f8a7ae | ||
|
74065cb4dc | ||
|
200b99dd68 | ||
|
bcae5e576d | ||
|
02e11c383f | ||
|
14a6e8befe | ||
|
972724e575 | ||
|
3a2bae9cf8 | ||
|
bec5c36d9d | ||
|
282adddf11 | ||
|
dc478202e9 | ||
|
ef846a0b4a | ||
|
817117621c | ||
|
10314b17db | ||
|
6b9c3f3bdc | ||
|
4dc1d605ee | ||
|
9e5e8a2603 | ||
|
66ea6283c6 | ||
|
ae238a4035 | ||
|
1f2edc66ab | ||
|
c0339d31bc | ||
|
5c4b7c0898 | ||
|
f9f9e53a58 | ||
|
141bd8154c | ||
|
aab7bc935a | ||
|
f457e7f7e3 | ||
|
061dda9f66 | ||
|
2663bcdde2 | ||
|
7d3420a450 | ||
|
895515478c | ||
|
b390ae01f4 | ||
|
b715465168 | ||
|
b3e96b44f5 | ||
|
88ccad98c7 | ||
|
d297609bb5 | ||
|
c3444b931c | ||
|
b6f24cf69d | ||
|
b4de320605 | ||
|
fe4ce7ec23 | ||
|
ecf3b566d1 | ||
|
2134068884 | ||
|
613966fb0a | ||
|
93a3788e0e | ||
|
6c73fe04e8 | ||
|
a1c1aeba5c | ||
|
45f2965573 | ||
|
6819dfc75a | ||
|
b98812eeaf | ||
|
e826202a33 |
@ -114,6 +114,8 @@ dotnet_style_prefer_conditional_expression_over_return = true:silent
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
|
||||
dotnet_style_prefer_auto_properties = true:suggestion
|
||||
csharp_prefer_simple_default_expression = true:suggestion
|
||||
dotnet_style_prefer_compound_assignment = false:silent
|
||||
dotnet_diagnostic.IDE0031.severity = none
|
||||
|
||||
dotnet_code_quality_unused_parameters = non_public:suggestion
|
||||
|
||||
|
27
.github/workflows/GHWorkflowHelper/GHWorkflowHelper.psm1
vendored
Normal file
27
.github/workflows/GHWorkflowHelper/GHWorkflowHelper.psm1
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
function Set-GWVariable {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Name,
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Value
|
||||
)
|
||||
|
||||
Write-Verbose "Setting CI variable $Name to $Value" -Verbose
|
||||
|
||||
if ($env:GITHUB_ENV) {
|
||||
"$Name=$Value" | Out-File $env:GITHUB_ENV -Append
|
||||
}
|
||||
}
|
||||
|
||||
function Get-GWTempPath {
|
||||
$temp = [System.IO.Path]::GetTempPath()
|
||||
if ($env:RUNNER_TEMP) {
|
||||
$temp = $env:RUNNER_TEMP
|
||||
}
|
||||
|
||||
Write-Verbose "Get CI Temp path: $temp" -Verbose
|
||||
return $temp
|
||||
}
|
79
.github/workflows/daily.yml
vendored
79
.github/workflows/daily.yml
vendored
@ -30,18 +30,16 @@ jobs:
|
||||
git fetch --prune --unshallow --tags
|
||||
- name: Execute Update .NET script
|
||||
run: |
|
||||
Import-Module .github/workflows/GHWorkflowHelper
|
||||
$currentVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
|
||||
Write-Verbose "OLD_VERSION=$currentVersion" -Verbose
|
||||
"OLD_VERSION=$currentVersion" | Out-File $env:GITHUB_ENV -Append
|
||||
Set-GWVariable -Name OLD_VERSION -Value $currentVersion
|
||||
|
||||
./tools/UpdateDotnetRuntime.ps1 -UpdateMSIPackaging -UseInternalFeed
|
||||
$newVersion = (Get-Content .\global.json | ConvertFrom-Json).sdk.version
|
||||
Write-Verbose "NEW_VERSION=$newVersion" -Verbose
|
||||
"NEW_VERSION=$newVersion" | Out-File $env:GITHUB_ENV -Append
|
||||
Set-GWVariable -Name NEW_VERSION -Value $newVersion
|
||||
|
||||
if ($currentVersion -ne $newVersion) {
|
||||
Write-Verbose "CREATE_PR=true" -Verbose
|
||||
"CREATE_PR=true" | Out-File $env:GITHUB_ENV -Append
|
||||
Set-GWVariable -Name CREATE_PR -Value 'true'
|
||||
}
|
||||
- name: Microsoft Teams Notifier
|
||||
uses: skitionek/notify-microsoft-teams@master
|
||||
@ -58,5 +56,70 @@ jobs:
|
||||
title: "Update .NET SDK version from `${{ env.OLD_VERSION }}` to `${{ env.NEW_VERSION }}`"
|
||||
base: master
|
||||
branch: dotnet_update
|
||||
|
||||
|
||||
update-tpn:
|
||||
name: Update Notices File
|
||||
timeout-minutes: 15
|
||||
runs-on: windows-latest
|
||||
if: github.repository == 'PowerShell/PowerShell'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Update Notices file
|
||||
run: |
|
||||
Invoke-WebRequest -Uri https://aka.ms/pwsh-daily-tpn -OutFile ./ThirdPartyNotices.txt
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
id: cprtpn
|
||||
with:
|
||||
commit-message: "Update to the latest NOTICES file"
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
title: "Update to the latest NOTICES file"
|
||||
reviewers: travisez13
|
||||
base: master
|
||||
draft: false
|
||||
branch: update-cgmanifest
|
||||
update-cgmanifest:
|
||||
name: Update cgmanifest
|
||||
timeout-minutes: 15
|
||||
runs-on: windows-latest
|
||||
if: github.repository == 'PowerShell/PowerShell'
|
||||
env:
|
||||
CGMANIFEST_PATH: ''
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Sync tags
|
||||
run: |
|
||||
git fetch --prune --unshallow --tags
|
||||
- name: Install Ships provider to deal with project.assets.json
|
||||
run: |
|
||||
Install-Module -Name dotnet.project.assets -force
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
Import-Module ./build.psm1
|
||||
Start-PSBootStrap
|
||||
- name: Verify cgmanifest is up to date
|
||||
run: |
|
||||
Import-Module ./build.psm1
|
||||
Find-Dotnet
|
||||
./tools/findMissingNotices.ps1 -Fix
|
||||
- name: Upload cgmanifest
|
||||
uses: actions/upload-artifact@v2
|
||||
if: always() && env.CGMANIFEST_PATH != ''
|
||||
with:
|
||||
name: cgmanifest
|
||||
path: ${{ env.CGMANIFEST_PATH }}
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
id: cprcgmanifest
|
||||
if: env.CGMANIFEST_PATH != ''
|
||||
with:
|
||||
commit-message: "Update the cgmanifest"
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
title: "Update the cgmanifest"
|
||||
reviewers: travisez13
|
||||
base: master
|
||||
draft: false
|
||||
branch: update-cgmanifest
|
||||
|
3
.github/workflows/markdown-link/config.json
vendored
Normal file
3
.github/workflows/markdown-link/config.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"aliveStatusCodes": [504, 503, 403, 200]
|
||||
}
|
20
.github/workflows/markdownLink.yml
vendored
Normal file
20
.github/workflows/markdownLink.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- 'release/**'
|
||||
paths:
|
||||
- '**.md'
|
||||
|
||||
name: Check links for modified files
|
||||
jobs:
|
||||
markdown-link-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||
with:
|
||||
use-quiet-mode: 'yes'
|
||||
use-verbose-mode: 'yes'
|
||||
check-modified-files-only: 'yes'
|
||||
config-file: .github/workflows/markdown-link/config.json
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -92,3 +92,6 @@ test/tools/Modules/SelfSignedCertificate/
|
||||
|
||||
# BenchmarkDotNet artifacts
|
||||
test/perf/BenchmarkDotNet.Artifacts/
|
||||
|
||||
# Ignore logfiles
|
||||
logfile/*
|
||||
|
44
.spelling
44
.spelling
@ -53,6 +53,7 @@ APIScan
|
||||
appimage
|
||||
applocker
|
||||
appveyor
|
||||
appx
|
||||
args
|
||||
argumentlist
|
||||
arm32
|
||||
@ -96,11 +97,13 @@ bugfix
|
||||
build.json
|
||||
build.psm1
|
||||
bulid
|
||||
buildInfoJson
|
||||
callmejoebob
|
||||
catchable
|
||||
cdxml
|
||||
celsius
|
||||
CentOS
|
||||
CGManifest
|
||||
changelog
|
||||
changelog.md
|
||||
changelogs
|
||||
@ -115,6 +118,8 @@ childitem
|
||||
ChrisLGardner
|
||||
cimsession
|
||||
cimsupport
|
||||
ci.psm1
|
||||
cgmanifest
|
||||
classlib
|
||||
clear-itemproperty
|
||||
cloudydino
|
||||
@ -277,10 +282,12 @@ filecatalog
|
||||
filename
|
||||
filesystem
|
||||
filesystemprovider
|
||||
files.wxs
|
||||
filterhashtable
|
||||
find-dscresource
|
||||
find-packageprovider
|
||||
find-rolecapability
|
||||
findMissingNotices.ps1
|
||||
firefox
|
||||
folderName
|
||||
foreach
|
||||
@ -295,6 +302,7 @@ functionprovider
|
||||
FunctionTable
|
||||
fxdependent
|
||||
gabrielsroka
|
||||
GAC_Arm64
|
||||
gamified
|
||||
gc.regions.xml
|
||||
Generic.SortedList
|
||||
@ -530,6 +538,7 @@ mvps
|
||||
mwrock
|
||||
myget
|
||||
namedpipe
|
||||
NameObscurerTelemetryInitializer
|
||||
nameof
|
||||
namespace
|
||||
nano
|
||||
@ -906,6 +915,7 @@ tracesource
|
||||
travisez13
|
||||
travisty
|
||||
truher
|
||||
TSAUpload
|
||||
TValue
|
||||
tylerleonhardt
|
||||
typecataloggen
|
||||
@ -1126,6 +1136,17 @@ Microsoft.Management.UI.Internal
|
||||
StringComparison
|
||||
osx-arm64
|
||||
crossgen2
|
||||
mcr.microsoft.com
|
||||
global.json
|
||||
sha256
|
||||
PkgES
|
||||
TabExpansion
|
||||
PSv2
|
||||
Microsoft.CSharp
|
||||
System.Data.SqlClient
|
||||
azcopy
|
||||
v7.2.10
|
||||
7.2.x
|
||||
- CHANGELOG.md
|
||||
aavdberg
|
||||
asrosent
|
||||
@ -1269,7 +1290,7 @@ package.json
|
||||
jcotton42
|
||||
RPMs
|
||||
PSDesiredStateConfiguration
|
||||
- CHANGELOG/preview.md
|
||||
- CHANGELOG/7.2.md
|
||||
Gimly
|
||||
jborean93
|
||||
mkswd
|
||||
@ -1383,6 +1404,27 @@ lselden
|
||||
SethFalco
|
||||
CodeQL
|
||||
slowy07
|
||||
rc.2.21505.57
|
||||
ThirdPartyNotices
|
||||
ThirdPartyNotices.txt
|
||||
cgmanifest.json
|
||||
buildinfo
|
||||
tar.gz
|
||||
psoptions.json
|
||||
manifest.spdx.json
|
||||
vPack
|
||||
kondratyev-nv
|
||||
v7.2.0
|
||||
v7.2.3
|
||||
cgmanifest.json
|
||||
pwsh.exe
|
||||
6.0.100-rtm.21527.11
|
||||
6.0.100-rc.2.21505.57
|
||||
ThirdPartyNotices.txt
|
||||
rtm.21527.11
|
||||
SKUs
|
||||
vmImage
|
||||
Ubuntu22.04
|
||||
- CHANGELOG/7.0.md
|
||||
codesign
|
||||
release-BuildJson
|
||||
|
@ -11,9 +11,9 @@ trigger:
|
||||
include:
|
||||
- '*'
|
||||
exclude:
|
||||
- /.vsts-ci/misc-analysis.yml
|
||||
- /.github/ISSUE_TEMPLATE/*
|
||||
- /.dependabot/config.yml
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- .github/ISSUE_TEMPLATE/*
|
||||
- .dependabot/config.yml
|
||||
- test/perf/*
|
||||
pr:
|
||||
branches:
|
||||
@ -30,6 +30,8 @@ pr:
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- .vsts-ci/windows.yml
|
||||
- .vsts-ci/windows/*
|
||||
- tools/cgmanifest.json
|
||||
- LICENSE.txt
|
||||
- test/common/markdown/*
|
||||
- test/perf/*
|
||||
- tools/releaseBuild/*
|
||||
|
@ -11,10 +11,10 @@ trigger:
|
||||
include:
|
||||
- '*'
|
||||
exclude:
|
||||
- /tools/releaseBuild/**/*
|
||||
- /.vsts-ci/misc-analysis.yml
|
||||
- /.github/ISSUE_TEMPLATE/*
|
||||
- /.dependabot/config.yml
|
||||
- tools/releaseBuild/**/*
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- .github/ISSUE_TEMPLATE/*
|
||||
- .dependabot/config.yml
|
||||
- test/perf/*
|
||||
pr:
|
||||
branches:
|
||||
@ -29,8 +29,10 @@ pr:
|
||||
- .dependabot/config.yml
|
||||
- .github/ISSUE_TEMPLATE/*
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- /.vsts-ci/windows.yml
|
||||
- /.vsts-ci/windows/*
|
||||
- .vsts-ci/windows.yml
|
||||
- .vsts-ci/windows/*
|
||||
- tools/cgmanifest.json
|
||||
- LICENSE.txt
|
||||
- test/common/markdown/*
|
||||
- test/perf/*
|
||||
- tools/packaging/*
|
||||
@ -97,10 +99,6 @@ stages:
|
||||
vmImage: macOS-latest
|
||||
steps:
|
||||
- pwsh: |
|
||||
# Remove old .NET SDKs
|
||||
if (Test-Path -Path $HOME/.dotnet) {
|
||||
Remove-Item $HOME/.dotnet -Recurse -Force
|
||||
}
|
||||
Import-Module .\tools\ci.psm1
|
||||
New-CodeCoverageAndTestPackage
|
||||
displayName: CodeCoverage and Test Package
|
||||
|
@ -90,20 +90,6 @@ jobs:
|
||||
condition: succeededOrFailed()
|
||||
workingDirectory: '$(repoPath)'
|
||||
|
||||
- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
|
||||
- pwsh: |
|
||||
Import-module ./build.psm1
|
||||
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
|
||||
$results = invoke-pester -Script ./test/common -OutputFile $path -OutputFormat NUnitXml -PassThru
|
||||
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Common Tests;publishRunAttachments=true;resultFiles=$path;]"
|
||||
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
|
||||
{
|
||||
throw "Markdown tests failed"
|
||||
}
|
||||
displayName: Run Common Tests
|
||||
condition: succeededOrFailed()
|
||||
workingDirectory: '$(repoPath)'
|
||||
|
||||
- template: dailyBuildCompliance.yml@ComplianceRepo
|
||||
parameters:
|
||||
sourceScanPath: '$(repoPath)'
|
||||
|
56
.vsts-ci/misc-analysis/mdSpell.yml
Normal file
56
.vsts-ci/misc-analysis/mdSpell.yml
Normal file
@ -0,0 +1,56 @@
|
||||
jobs:
|
||||
- job: markdown
|
||||
displayName: Markdown Spelling
|
||||
|
||||
pool:
|
||||
vmImage: ubuntu-20.04
|
||||
|
||||
variables:
|
||||
- name: repoPath
|
||||
value: $(Agent.BuildDirectory)/$(repoFolder)
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
path: $(repoFolder)
|
||||
|
||||
- checkout: ComplianceRepo
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem -Path env:
|
||||
displayName: Capture Environment
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- bash: |
|
||||
curl -o- --progress-bar -L https://yarnpkg.com/install.sh | bash
|
||||
displayName: Bootstrap Yarn
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- bash: |
|
||||
sudo yarn global add markdown-spellcheck@0.11.0
|
||||
displayName: Install mdspell
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- bash: |
|
||||
mdspell '**/*.md' '!**/Pester/**/*.md' '!**/dotnet-tools/**/*.md' --ignore-numbers --ignore-acronyms --report --en-us;
|
||||
displayName: Test Spelling in Markdown
|
||||
condition: succeededOrFailed()
|
||||
workingDirectory: '$(repoPath)'
|
||||
|
||||
- ${{ if not(contains(variables['SYSTEM.COLLECTIONURI'],'mscodehub')) }}:
|
||||
- pwsh: |
|
||||
Import-module ./build.psm1
|
||||
$path = Join-Path -Path $pwd -ChildPath './commonTestResults.xml'
|
||||
$results = invoke-pester -Script ./test/common/markdown-lint -OutputFile $path -OutputFormat NUnitXml -PassThru
|
||||
Write-Host "##vso[results.publish type=NUnit;mergeResults=true;runTitle=Markdown Lint;publishRunAttachments=true;resultFiles=$path;]"
|
||||
if($results.TotalCount -eq 0 -or $results.FailedCount -gt 0)
|
||||
{
|
||||
throw "Markdown tests failed"
|
||||
}
|
||||
displayName: Run Markdown Lint Tests
|
||||
condition: succeededOrFailed()
|
||||
workingDirectory: '$(repoPath)'
|
||||
|
||||
- template: dailyBuildCompliance.yml@ComplianceRepo
|
||||
parameters:
|
||||
sourceScanPath: '$(repoPath)/test/common'
|
@ -34,6 +34,8 @@ resources:
|
||||
clean: true
|
||||
jobs:
|
||||
- job: SSHRemotingTests
|
||||
pool:
|
||||
vmImage: ubuntu-20.04
|
||||
container: mcr.microsoft.com/powershell/test-deps:ubuntu-18.04
|
||||
displayName: SSH Remoting Tests
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
parameters:
|
||||
pool: 'vs2017-win2016'
|
||||
pool: 'windows-latest'
|
||||
jobName: 'win_build'
|
||||
displayName: Windows Build
|
||||
|
||||
@ -11,38 +11,31 @@ jobs:
|
||||
displayName: ${{ parameters.displayName }}
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
- pwsh: |
|
||||
Get-ChildItem -Path env:
|
||||
displayName: Capture Environment
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
|
||||
- pwsh: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
|
||||
displayName: Set Build Name for Non-PR
|
||||
condition: ne(variables['Build.Reason'], 'PullRequest')
|
||||
|
||||
- ${{ if ne(variables['AzDevOpsFeed'], '') }}:
|
||||
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
|
||||
|
||||
- pwsh: |
|
||||
if (Test-Path -Path $HOME/.dotnet) {
|
||||
Remove-Item $HOME/.dotnet -Recurse -Force
|
||||
}
|
||||
displayName: Remove Old .NET SDKs
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Invoke-CIInstall -SkipUser
|
||||
displayName: Bootstrap
|
||||
condition: succeeded()
|
||||
|
||||
- powershell: |
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Invoke-CIBuild
|
||||
displayName: Build
|
||||
condition: succeeded()
|
||||
|
||||
- powershell: |
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Restore-PSOptions
|
||||
Invoke-CIxUnit -SkipFailing
|
||||
|
@ -1,12 +1,12 @@
|
||||
parameters:
|
||||
pool: 'Hosted VS2017'
|
||||
pool: 'windows-latest'
|
||||
jobName: 'credscan'
|
||||
displayName: Secret Scan
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.jobName }}
|
||||
pool:
|
||||
name: ${{ parameters.pool }}
|
||||
vmImage: ${{ parameters.pool }}
|
||||
|
||||
displayName: ${{ parameters.displayName }}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
parameters:
|
||||
vmImage: 'windows-2019'
|
||||
vmImage: 'windows-latest'
|
||||
jobName: 'Nanoserver_Tests'
|
||||
continueOnError: false
|
||||
|
||||
|
@ -33,13 +33,6 @@ jobs:
|
||||
displayName: 'Capture Artifacts Directory'
|
||||
continueOnError: true
|
||||
|
||||
- pwsh: |
|
||||
if (Test-Path -Path $HOME/.dotnet) {
|
||||
Remove-Item $HOME/.dotnet -Recurse -Force
|
||||
}
|
||||
displayName: Remove Old .NET SDKs
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
Invoke-CIInstall -SkipUser
|
||||
|
@ -1,6 +1,6 @@
|
||||
parameters:
|
||||
parentJobs: []
|
||||
pool: 'vs2017-win2016'
|
||||
pool: 'windows-latest'
|
||||
jobName: 'xunit_verify'
|
||||
|
||||
jobs:
|
||||
|
@ -1,5 +1,5 @@
|
||||
parameters:
|
||||
pool: 'Hosted VS2017'
|
||||
pool: 'windows-latest'
|
||||
parentJobs: []
|
||||
purpose: ''
|
||||
tagSet: 'CI'
|
||||
@ -9,7 +9,7 @@ jobs:
|
||||
dependsOn:
|
||||
${{ parameters.parentJobs }}
|
||||
pool:
|
||||
name: ${{ parameters.pool }}
|
||||
vmImage: ${{ parameters.pool }}
|
||||
|
||||
displayName: Windows Test - ${{ parameters.purpose }} - ${{ parameters.tagSet }}
|
||||
|
||||
|
@ -53,7 +53,7 @@ stages:
|
||||
jobs:
|
||||
- job: win_test
|
||||
pool:
|
||||
vmImage: vs2017-win2016
|
||||
vmImage: windows-latest
|
||||
displayName: Windows Test
|
||||
timeoutInMinutes: 90
|
||||
|
||||
|
@ -11,9 +11,9 @@ trigger:
|
||||
include:
|
||||
- '*'
|
||||
exclude:
|
||||
- /.vsts-ci/misc-analysis.yml
|
||||
- /.github/ISSUE_TEMPLATE/*
|
||||
- /.dependabot/config.yml
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- .github/ISSUE_TEMPLATE/*
|
||||
- .dependabot/config.yml
|
||||
- test/perf/*
|
||||
pr:
|
||||
branches:
|
||||
@ -28,6 +28,8 @@ pr:
|
||||
- .dependabot/config.yml
|
||||
- .github/ISSUE_TEMPLATE/*
|
||||
- .vsts-ci/misc-analysis.yml
|
||||
- tools/cgmanifest.json
|
||||
- LICENSE.txt
|
||||
- test/common/markdown/*
|
||||
- test/perf/*
|
||||
- tools/packaging/*
|
||||
|
@ -1,25 +1,53 @@
|
||||
parameters:
|
||||
pool: 'Hosted VS2017'
|
||||
jobName: 'win_packaging'
|
||||
architecture: 'x64'
|
||||
channel: 'preview'
|
||||
parentJobs: []
|
||||
- name: pool
|
||||
default: 'windows-latest'
|
||||
- name: jobName
|
||||
default: 'win_packaging'
|
||||
- name: runtimePrefix
|
||||
default: 'win7'
|
||||
- name: architecture
|
||||
default: 'x64'
|
||||
- name: channel
|
||||
default: 'preview'
|
||||
|
||||
jobs:
|
||||
- job: ${{ parameters.jobName }}_${{ parameters.channel }}_${{ parameters.architecture }}
|
||||
dependsOn:
|
||||
${{ parameters.parentJobs }}
|
||||
|
||||
variables:
|
||||
- name: repoFolder
|
||||
value: PowerShell
|
||||
- name: repoPath
|
||||
value: $(Agent.BuildDirectory)\$(repoFolder)
|
||||
- name: complianceRepoFolder
|
||||
value: compliance
|
||||
- name: complianceRepoPath
|
||||
value: $(Agent.BuildDirectory)\$(complianceRepoFolder)
|
||||
|
||||
pool:
|
||||
name: ${{ parameters.pool }}
|
||||
vmImage: ${{ parameters.pool }}
|
||||
|
||||
displayName: Windows Packaging - ${{ parameters.architecture }} - ${{ parameters.channel }}
|
||||
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
path: $(repoFolder)
|
||||
|
||||
- checkout: ComplianceRepo
|
||||
clean: true
|
||||
path: $(complianceRepoFolder)
|
||||
|
||||
- powershell: |
|
||||
Get-ChildItem -Path env:
|
||||
displayName: Capture environment
|
||||
condition: succeededOrFailed()
|
||||
|
||||
- pwsh: |
|
||||
$PSVersionTable
|
||||
displayName: Capture PowerShell Version Table
|
||||
condition: succeededOrFailed()
|
||||
|
||||
|
||||
- template: /tools/releaseBuild/azureDevOps/templates/insert-nuget-config-azfeed.yml
|
||||
|
||||
- pwsh: |
|
||||
@ -27,9 +55,25 @@ jobs:
|
||||
Invoke-CIInstall -SkipUser
|
||||
displayName: Bootstrap
|
||||
condition: succeeded()
|
||||
workingDirectory: $(repoPath)
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
New-CodeCoverageAndTestPackage
|
||||
Invoke-CIFinish -Runtime win7-${{ parameters.architecture }} -channel ${{ parameters.channel }}
|
||||
displayName: Build and Test Package
|
||||
Invoke-CIFinish -Runtime ${{ parameters.runtimePrefix }}-${{ parameters.architecture }} -channel ${{ parameters.channel }} -Stage Build
|
||||
displayName: Build
|
||||
workingDirectory: $(repoPath)
|
||||
|
||||
- template: Sbom.yml@ComplianceRepo
|
||||
parameters:
|
||||
BuildDropPath: '$(System.ArtifactsDirectory)/mainBuild'
|
||||
Build_Repository_Uri: $(build.repository.uri)
|
||||
displayName: SBOM
|
||||
sourceScanPath: '$(repoPath)\tools'
|
||||
|
||||
- pwsh: |
|
||||
Import-Module .\tools\ci.psm1
|
||||
New-CodeCoverageAndTestPackage
|
||||
Invoke-CIFinish -Runtime ${{ parameters.runtimePrefix }}-${{ parameters.architecture }} -channel ${{ parameters.channel }} -Stage Package
|
||||
displayName: Package and Test
|
||||
workingDirectory: $(repoPath)
|
||||
|
@ -51,6 +51,7 @@ pr:
|
||||
- src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj
|
||||
- src/Modules/PSGalleryModules.csproj
|
||||
- src/powershell-win-core/powershell-win-core.csproj
|
||||
- test/packaging/windows/*
|
||||
- tools/ci.psm1
|
||||
- tools/packaging/*
|
||||
|
||||
@ -67,10 +68,17 @@ variables:
|
||||
- name: __SuppressAnsiEscapeSequences
|
||||
value: 1
|
||||
- group: fakeNugetKey
|
||||
- name: SBOMGenerator_Formats
|
||||
value: spdx:2.2
|
||||
|
||||
resources:
|
||||
- repo: self
|
||||
clean: true
|
||||
repositories:
|
||||
- repository: ComplianceRepo
|
||||
type: github
|
||||
endpoint: PowerShell
|
||||
name: PowerShell/compliance
|
||||
ref: master
|
||||
|
||||
stages:
|
||||
- stage: PackagingWin
|
||||
displayName: Packaging for Windows
|
||||
@ -86,3 +94,13 @@ stages:
|
||||
parameters:
|
||||
channel: preview
|
||||
architecture: x86
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
channel: preview
|
||||
architecture: arm
|
||||
runtimePrefix: win
|
||||
- template: templates/windows-packaging.yml
|
||||
parameters:
|
||||
channel: preview
|
||||
architecture: arm64
|
||||
runtimePrefix: win
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0-rc2.21458.5" PrivateAssets="all" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
1513
CHANGELOG/7.2.md
Normal file
1513
CHANGELOG/7.2.md
Normal file
File diff suppressed because it is too large
Load Diff
1033
CHANGELOG/preview.md
1033
CHANGELOG/preview.md
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,15 @@
|
||||
{
|
||||
"sdk": {
|
||||
"channel": "6.0.1xx-rc1",
|
||||
"quality": "signed",
|
||||
"channel": "6.0.4xx",
|
||||
"quality": "ga",
|
||||
"qualityFallback": "daily",
|
||||
"packageVersionPattern": "6.0.0-rc.1",
|
||||
"sdkImageVersion": "6.0.100",
|
||||
"nextChannel": "6.0.1xx-rc1"
|
||||
"packageVersionPattern": "6.0.0",
|
||||
"sdkImageVersion": "6.0.410",
|
||||
"nextChannel": "6.0.4xx",
|
||||
"azureFeed": "",
|
||||
"sdkImageOverride": "6.0.410"
|
||||
},
|
||||
"internalfeed" : {
|
||||
"url": "https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.1.21458.32-shipping/nuget/v2"
|
||||
"url": ""
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<PublishReadyToRun Condition=" '$(Configuration)' != 'Debug' ">true</PublishReadyToRun>
|
||||
<PublishReadyToRunEmitSymbols>true</PublishReadyToRunEmitSymbols>
|
||||
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
@ -171,10 +172,11 @@
|
||||
<!-- Define all OS, release configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define windows, release configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' == 'true' ">
|
||||
<!-- Define all OS, release configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'StaticAnalysis' ">
|
||||
<Optimize>true</Optimize>
|
||||
<!-- This is required to be full for compliance tools !-->
|
||||
<DebugType>full</DebugType>
|
||||
@ -186,13 +188,6 @@
|
||||
Debugging the issues resolves the problem
|
||||
-->
|
||||
<Optimize>false</Optimize>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define all OS, CodeCoverage configuration properties -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'CodeCoverage' ">
|
||||
<!-- This is required to be portable to Coverlet tool !-->
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -143,7 +143,7 @@ For more information on how and why we built this dashboard, check out this [blo
|
||||
|
||||
## Discussions
|
||||
|
||||
[GitHub Discussions](https://docs.github.com/en/free-pro-team@latest/discussions/quickstart) is a feature to enable fluid and open discussions within the community
|
||||
[GitHub Discussions](https://docs.github.com/discussions/quickstart) is a feature to enable fluid and open discussions within the community
|
||||
for topics that are not related to code, unlike issues.
|
||||
|
||||
This is an experiment we are trying in our repositories to see if it helps move discussions out of issues so that issues remain actionable by the team or members of the community.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -45,5 +45,7 @@
|
||||
<Capability Name="internetClient" />
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
<rescap:Capability Name="unvirtualizedResources" />
|
||||
<rescap:Capability Name="packageManagement" />
|
||||
<rescap:Capability Name="packageQuery" />
|
||||
</Capabilities>
|
||||
</Package>
|
||||
|
@ -1,46 +1,42 @@
|
||||
## Used to generate a new TPN
|
||||
## Copy this into the additional attributions fields
|
||||
## Copy everything below here, but do not include this line
|
||||
|
||||
---------------------------------------------
|
||||
File: PSReadLine
|
||||
---------------------------------------------
|
||||
-------------------------------------------------------------------
|
||||
|
||||
https://github.com/lzybkr/PSReadLine
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2013, Jason Shirk
|
||||
Additional -
|
||||
|
||||
All rights reserved.
|
||||
-------------------------------------------------
|
||||
Microsoft.PowerShell.Archive
|
||||
-------------------------------------------------
|
||||
|
||||
BSD License
|
||||
Copyright (c) 2016 Microsoft Corporation.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
The MIT License (MIT)
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
----------------------------------------------
|
||||
File: Hashtables from ConvertFrom-json
|
||||
----------------------------------------------
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
https://stackoverflow.com/questions/22002748/hashtables-from-convertfrom-json-have-different-type-from-powershells-built-in-h
|
||||
-------------------------------------------------
|
||||
Microsoft.Management.Infrastructure.Runtime.Unix
|
||||
Microsoft.Management.Infrastructure
|
||||
-------------------------------------------------
|
||||
|
||||
Copyright (c) 2015 Dave Wyatt. All rights reserved.
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@ -52,33 +48,6 @@ The above copyright notice and this permission notice shall be included in all c
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-------------------------------------------------
|
||||
PackageManagement
|
||||
-------------------------------------------------
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the Software), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
--------------------------------------------------------
|
||||
• NuGet.Common
|
||||
• NuGet.Configuration
|
||||
@ -108,3 +77,116 @@ Unless required by applicable law or agreed to in writing, software distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations under the License.
|
||||
|
||||
-------------------------------------------------
|
||||
PackageManagement
|
||||
-------------------------------------------------
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the Software), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
-------------------------------------------------
|
||||
PowerShellGet
|
||||
-------------------------------------------------
|
||||
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
---------------------------------------------
|
||||
File: PSReadLine
|
||||
---------------------------------------------
|
||||
|
||||
https://github.com/PowerShell/PSReadLine
|
||||
|
||||
Copyright (c) 2013, Jason Shirk
|
||||
|
||||
All rights reserved.
|
||||
|
||||
BSD License
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------
|
||||
ThreadJob
|
||||
-------------------------------------------------
|
||||
|
||||
Copyright (c) 2018 Paul Higinbotham
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
@ -110,7 +110,7 @@
|
||||
<UI>
|
||||
<Dialog Id="MyExitDialog" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
|
||||
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="yes" Text="!(loc.ExitDialogBitmap)" />
|
||||
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" TabSkip="yes" />
|
||||
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Bigger}!(loc.Error1707)" TabSkip="yes" />
|
||||
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="20" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" TabSkip="yes" />
|
||||
<!-- divider between check boxes and button row -->
|
||||
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" TabSkip="yes" />
|
||||
@ -350,7 +350,7 @@
|
||||
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" TabSkip="yes" />
|
||||
<Control Id="Description" Type="Text" X="25" Y="54" Width="280" Height="100" Transparent="yes" NoPrefix="yes" Text="Microsoft Update helps keep your computer secure and up to date for Windows and other Microsoft products, including PowerShell 7. Updates will be delivered based on your current update settings. You can review or change these settings from the Windows Update control panel." TabSkip="yes" />
|
||||
<!-- If the checkboxes are defined first, then they are first in the tab order and can be ticked and unticked using the spacebar -->
|
||||
<Control Id="UseMuCheckBox" Type="CheckBox" X="20" Y="100" Width="290" Height="27" Property="USE_MU" CheckBoxValue="1" Text="Enable updating PowerShell through Microsft Update or WSUS (recommended)"/>
|
||||
<Control Id="UseMuCheckBox" Type="CheckBox" X="20" Y="100" Width="290" Height="27" Property="USE_MU" CheckBoxValue="1" Text="Enable updating PowerShell through Microsoft Update or WSUS (recommended)"/>
|
||||
<Control Id="EnableMuCheckBox" Type="CheckBox" X="20" Y="130" Width="290" Height="17" Property="ENABLE_MU" CheckBoxValue="1" Text="Use Microsoft Update when I check for updates (recommended)">
|
||||
</Control>
|
||||
<Control Id="MuWarningText" Type="Text" X="20" Y="160" Width="290" Height="27" Text="Without Microsoft Update enabled, you will need to use another update solution like WSUS or SCCM in order to receive automatic updates.">
|
||||
@ -361,7 +361,7 @@
|
||||
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-FAQ">See the Microsoft Update FAQ</a>]]></Text>
|
||||
</Control>
|
||||
<Control Id="PrivacyLink" Type="Hyperlink" X="20" Y="210" Width="290" Height="17">
|
||||
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-Privacy-Statement">Read the Microsoft Update Priacy Statement</a>]]></Text>
|
||||
<Text><![CDATA[<a href="https://aka.ms/PowerShell-Microsoft-Update-Privacy-Statement">Read the Microsoft Update Privacy Statement</a>]]></Text>
|
||||
</Control>
|
||||
<!-- divider and bottom buttons -->
|
||||
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" TabSkip="yes"/>
|
||||
|
4047
assets/wix/files.wxs
4047
assets/wix/files.wxs
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Patch
|
||||
AllowRemoval="yes"
|
||||
Manufacturer="Microsoft Powershell"
|
||||
MoreInfoURL="https://github.com/powershell/powershell"
|
||||
DisplayName="Sample Patch"
|
||||
Description="Small Update Patch"
|
||||
Classification="Update"
|
||||
>
|
||||
|
||||
<Media Id="5000" Cabinet="RTM.cab">
|
||||
<PatchBaseline Id="RTM"/>
|
||||
</Media>
|
||||
|
||||
<PatchFamilyRef Id="SamplePatchFamily"/>
|
||||
</Patch>
|
||||
|
||||
<Fragment>
|
||||
<PatchFamily Id='SamplePatchFamily' Version='6.1.1' Supersede='yes'>
|
||||
<PropertyRef Id="ProductVersion"/>
|
||||
</PatchFamily>
|
||||
</Fragment>
|
||||
</Wix>
|
741
build.psm1
741
build.psm1
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
# Docker tests
|
||||
|
||||
## Windows and Linux containers
|
||||
|
||||
The tests must be run separately on the Windows and Linux docker daemons. You can use the Linux docker daemon on Windows, but that will only test Linux containers not Windows Containers.
|
||||
|
||||
## To building and basic behavior of the containers
|
||||
|
||||
```PowerShell
|
||||
Invoke-Pester
|
||||
```
|
||||
|
||||
Note: be sure to do this using both the Windows and Linux docker daemon.
|
||||
|
||||
## To test the productions containers
|
||||
|
||||
```PowerShell
|
||||
Invoke-Pester -Tag Behavior
|
||||
```
|
||||
|
||||
## To test only building the containers
|
||||
|
||||
```PowerShell
|
||||
Invoke-Pester -Tag Build
|
||||
```
|
@ -1,23 +0,0 @@
|
||||
FROM centos:7
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN yum install -y \
|
||||
curl \
|
||||
glibc-locale-source \
|
||||
git
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME \
|
||||
&& yum install -y $PACKAGENAME
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,29 +0,0 @@
|
||||
FROM debian:stretch
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
curl \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||
RUN dpkg -i $PACKAGENAME || :
|
||||
RUN apt-get install -y -f --no-install-recommends
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,26 +0,0 @@
|
||||
FROM fedora:28
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN dnf install -y \
|
||||
curl \
|
||||
glibc-locale-source \
|
||||
git \
|
||||
compat-openssl10 \
|
||||
&& dnf upgrade-minimal -y --security \
|
||||
&& dnf clean all
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||
RUN dnf install -y $PACKAGENAME
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,31 +0,0 @@
|
||||
FROM centos:7
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN yum install -y \
|
||||
glibc-locale-source \
|
||||
git
|
||||
|
||||
# Install dotnet-runtime
|
||||
RUN rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm
|
||||
RUN yum install -y \
|
||||
dotnet-runtime-2.1
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell
|
||||
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,31 +0,0 @@
|
||||
FROM microsoft/dotnet:2.1.7-runtime-stretch-slim
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell
|
||||
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,31 +0,0 @@
|
||||
FROM microsoft/dotnet:3.0.100-preview-sdk
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell \
|
||||
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,38 +0,0 @@
|
||||
FROM fedora:28
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN dnf install -y \
|
||||
glibc-locale-source \
|
||||
git \
|
||||
compat-openssl10 \
|
||||
&& dnf upgrade-minimal -y --security \
|
||||
&& dnf clean all
|
||||
|
||||
# Install dotnet-runtime
|
||||
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc
|
||||
ADD https://packages.microsoft.com/config/fedora/27/prod.repo .
|
||||
RUN mv prod.repo /etc/yum.repos.d/microsoft-prod.repo
|
||||
RUN dnf install -y \
|
||||
dotnet-runtime-2.1 \
|
||||
&& dnf upgrade-minimal -y --security \
|
||||
&& dnf clean all
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell \
|
||||
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,41 +0,0 @@
|
||||
FROM opensuse:42.3
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN zypper --non-interactive update --skip-interactive \
|
||||
&& zypper --non-interactive install \
|
||||
glibc-locale \
|
||||
glibc-i18ndata \
|
||||
tar \
|
||||
libunwind \
|
||||
libicu \
|
||||
openssl \
|
||||
git
|
||||
|
||||
# Install dotnet-runtime
|
||||
ADD https://packages.microsoft.com/keys/microsoft.asc .
|
||||
RUN rpmkeys --import microsoft.asc
|
||||
ADD https://packages.microsoft.com/config/opensuse/42.2/prod.repo .
|
||||
RUN mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo
|
||||
RUN zypper --non-interactive update --skip-interactive \
|
||||
&& zypper --non-interactive install \
|
||||
dotnet-runtime-2.1
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell
|
||||
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,39 +0,0 @@
|
||||
FROM ubuntu:xenial
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Install dotnet-runtime
|
||||
ADD https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb .
|
||||
RUN dpkg -i packages-microsoft-prod.deb
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
dotnet-runtime-2.1 \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell \
|
||||
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,31 +0,0 @@
|
||||
FROM microsoft/dotnet:2.1.7-runtime-bionic
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
# Install PowerShell package
|
||||
ADD $PACKAGELOCATION/$PACKAGENAME .
|
||||
RUN mkdir -p /opt/microsoft/powershell \
|
||||
&& tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Download and run tests
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN dotnet /opt/microsoft/powershell/pwsh.dll -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,39 +0,0 @@
|
||||
FROM opensuse:42.3
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
ARG POWERSHELL_LINKFILE=/usr/bin/pwsh
|
||||
|
||||
# Install dependencies
|
||||
RUN zypper --non-interactive update --skip-interactive \
|
||||
&& zypper --non-interactive install \
|
||||
glibc-locale \
|
||||
glibc-i18ndata \
|
||||
tar \
|
||||
curl \
|
||||
libunwind \
|
||||
libicu \
|
||||
openssl \
|
||||
git
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN localedef --charmap=UTF-8 --inputfile=en_US $LANG
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||
|
||||
# Create the target folder where powershell will be placed
|
||||
RUN mkdir -p /opt/microsoft/powershell
|
||||
# Expand powershell to the target folder
|
||||
RUN tar zxf $PACKAGENAME -C /opt/microsoft/powershell
|
||||
|
||||
# Create the symbolic link that points to powershell
|
||||
RUN ln -s /opt/microsoft/powershell/pwsh $POWERSHELL_LINKFILE
|
||||
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,29 +0,0 @@
|
||||
FROM ubuntu:xenial
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
curl \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||
RUN dpkg -i $PACKAGENAME || :
|
||||
RUN apt-get install -y -f --no-install-recommends
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,29 +0,0 @@
|
||||
FROM ubuntu:bionic
|
||||
|
||||
ARG PACKAGENAME
|
||||
ARG PACKAGELOCATION
|
||||
ARG PREVIEWSUFFIX=
|
||||
ARG TESTLIST=/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module
|
||||
ARG TESTDOWNLOADCOMMAND="git clone --recursive https://github.com/PowerShell/PowerShell.git"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
apt-utils \
|
||||
ca-certificates \
|
||||
curl \
|
||||
apt-transport-https \
|
||||
locales \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Setup the locale
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV LC_ALL $LANG
|
||||
RUN locale-gen $LANG && update-locale
|
||||
|
||||
RUN curl -L -o $PACKAGENAME $PACKAGELOCATION/$PACKAGENAME
|
||||
RUN dpkg -i $PACKAGENAME || :
|
||||
RUN apt-get install -y -f --no-install-recommends
|
||||
RUN $TESTDOWNLOADCOMMAND
|
||||
RUN pwsh$PREVIEWSUFFIX -c "Import-Module /PowerShell/build.psm1;\$dir='/usr/local/share/powershell/Modules';\$null=New-Item -Type Directory -Path \$dir -ErrorAction SilentlyContinue;Restore-PSPester -Destination \$dir;exit (Invoke-Pester $TESTLIST -PassThru).FailedCount"
|
@ -1,370 +0,0 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
|
||||
$script:forcePull = $true
|
||||
# Get docker Engine OS
|
||||
function Get-DockerEngineOs
|
||||
{
|
||||
docker info --format '{{ .OperatingSystem }}'
|
||||
}
|
||||
|
||||
# Call Docker with appropriate result checksfunction Invoke-Docker
|
||||
function Invoke-Docker
|
||||
{
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string[]]
|
||||
$Command,
|
||||
[ValidateSet("error","warning",'ignore')]
|
||||
$FailureAction = 'error',
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string[]]
|
||||
$Params,
|
||||
|
||||
[switch]
|
||||
$PassThru,
|
||||
[switch]
|
||||
$SuppressHostOutput
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
# Log how we are running docker for troubleshooting issues
|
||||
Write-Verbose "Running docker $command $params" -Verbose
|
||||
if($SuppressHostOutput.IsPresent)
|
||||
{
|
||||
$result = docker $command $params 2>&1
|
||||
}
|
||||
else
|
||||
{
|
||||
&'docker' $command $params 2>&1 | Tee-Object -Variable result -ErrorAction SilentlyContinue | Out-String -Stream -ErrorAction SilentlyContinue | Write-Host -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
$dockerExitCode = $LASTEXITCODE
|
||||
if($PassThru.IsPresent)
|
||||
{
|
||||
Write-Verbose "passing through docker result$($result.length)..." -Verbose
|
||||
return $result
|
||||
}
|
||||
elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'error')
|
||||
{
|
||||
Write-Error "docker $command failed with: $result" -ErrorAction Stop
|
||||
return $false
|
||||
}
|
||||
elseif($dockerExitCode -ne 0 -and $FailureAction -eq 'warning')
|
||||
{
|
||||
Write-Warning "docker $command failed with: $result"
|
||||
return $false
|
||||
}
|
||||
elseif($dockerExitCode -ne 0)
|
||||
{
|
||||
return $false
|
||||
}
|
||||
|
||||
return $true
|
||||
}
|
||||
|
||||
# Return a list of Linux Container Test Cases
|
||||
function Get-LinuxContainer
|
||||
{
|
||||
foreach($os in 'centos7','ubuntu16.04')
|
||||
{
|
||||
Write-Output @{
|
||||
Name = $os
|
||||
Path = "$PSScriptRoot/../release/$os"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Return a list of Windows Container Test Cases
|
||||
function Get-WindowsContainer
|
||||
{
|
||||
foreach($os in 'windowsservercore','nanoserver')
|
||||
{
|
||||
Write-Output @{
|
||||
Name = $os
|
||||
Path = "$PSScriptRoot/../release/$os"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$script:repoName = 'microsoft/powershell'
|
||||
function Get-RepoName
|
||||
{
|
||||
return $script:repoName
|
||||
}
|
||||
|
||||
function Set-RepoName
|
||||
{
|
||||
param([string]$RepoName)
|
||||
|
||||
$script:repoName = $RepoName
|
||||
$script:forcePull = $false
|
||||
}
|
||||
|
||||
function Test-SkipWindows
|
||||
{
|
||||
[bool] $canRunWindows = (Get-DockerEngineOs) -like 'Windows*'
|
||||
return ($IsLinux -or $IsMacOS -or !$canRunWindows)
|
||||
}
|
||||
|
||||
function Test-SkipLinux
|
||||
{
|
||||
$os = Get-DockerEngineOs
|
||||
|
||||
switch -wildcard ($os)
|
||||
{
|
||||
'*Linux*' {
|
||||
return $false
|
||||
}
|
||||
'*Mac' {
|
||||
return $false
|
||||
}
|
||||
# Docker for Windows means we are running the linux kernel
|
||||
'Docker for Windows' {
|
||||
return $false
|
||||
}
|
||||
'Windows*' {
|
||||
return $true
|
||||
}
|
||||
default {
|
||||
throw "Unknown docker os '$os'"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Get-TestContext
|
||||
{
|
||||
param(
|
||||
[ValidateSet('Linux','Windows','macOS')]
|
||||
[string]$Type
|
||||
)
|
||||
|
||||
$resultFileName = 'results.xml'
|
||||
$logFileName = 'results.log'
|
||||
$containerTestDrive = '/test'
|
||||
|
||||
# Return a windows context if the Context in Windows *AND*
|
||||
# the current system is windows, otherwise Join-path will fail.
|
||||
if($Type -eq 'Windows' -and $IsWindows)
|
||||
{
|
||||
$ContainerTestDrive = 'C:\test'
|
||||
}
|
||||
$resolvedTestDrive = (Resolve-Path "Testdrive:\").providerPath
|
||||
|
||||
return @{
|
||||
ResolvedTestDrive = $resolvedTestDrive
|
||||
ResolvedXmlPath = Join-Path $resolvedTestDrive -ChildPath $resultFileName
|
||||
ResolvedLogPath = Join-Path $resolvedTestDrive -ChildPath $logFileName
|
||||
ContainerTestDrive = $ContainerTestDrive
|
||||
ContainerXmlPath = Join-Path $containerTestDrive -ChildPath $resultFileName
|
||||
ContainerLogPath = Join-Path $containerTestDrive -ChildPath $logFileName
|
||||
Type = $Type
|
||||
ForcePull = $script:forcePull
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ContainerPowerShellVersion
|
||||
{
|
||||
param(
|
||||
[HashTable] $TestContext,
|
||||
[string] $RepoName,
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
$imageTag = "${script:repoName}:${Name}"
|
||||
|
||||
if($TestContext.ForcePull)
|
||||
{
|
||||
$null=Invoke-Docker -Command 'image', 'pull' -Params $imageTag -SuppressHostOutput
|
||||
}
|
||||
|
||||
$runParams = @()
|
||||
$localVolumeName = $testContext.resolvedTestDrive
|
||||
$runParams += '--rm'
|
||||
if($TestContext.Type -ne 'Windows' -and $IsWindows)
|
||||
{
|
||||
# use a container volume on windows because host volumes are not automatic
|
||||
$volumeName = "test-volume-" + (Get-Random -Minimum 100 -Maximum 999)
|
||||
|
||||
# using alpine because it's tiny
|
||||
$null=Invoke-Docker -Command create -Params '-v', '/test', '--name', $volumeName, 'alpine' -SuppressHostOutput
|
||||
$runParams += '--volumes-from'
|
||||
$runParams += $volumeName
|
||||
}
|
||||
else {
|
||||
$runParams += '-v'
|
||||
$runParams += "${localVolumeName}:$($testContext.containerTestDrive)"
|
||||
}
|
||||
|
||||
$runParams += $imageTag
|
||||
$runParams += 'pwsh'
|
||||
$runParams += '-c'
|
||||
$runParams += ('$PSVersionTable.PSVersion.ToString() | out-string | out-file -encoding ascii -FilePath '+$testContext.containerLogPath)
|
||||
|
||||
$null = Invoke-Docker -Command run -Params $runParams -SuppressHostOutput
|
||||
if($TestContext.Type -ne 'Windows' -and $IsWindows)
|
||||
{
|
||||
$null = Invoke-Docker -Command cp -Params "${volumeName}:$($testContext.containerLogPath)", $TestContext.ResolvedLogPath
|
||||
$null = Invoke-Docker -Command container, rm -Params $volumeName, '--force' -SuppressHostOutput
|
||||
}
|
||||
return (Get-Content -Encoding Ascii $testContext.resolvedLogPath)[0]
|
||||
}
|
||||
|
||||
# Function defines a config mapping for testing Preview packages.
|
||||
# The list of supported OS for each release can be found here:
|
||||
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
|
||||
function Get-DefaultPreviewConfigForPackageValidation
|
||||
{
|
||||
# format: <DockerfileFolderName>=<PartOfPackageFilename>
|
||||
@{ 'centos7'='rhel.7';
|
||||
'debian.9'='debian.9';
|
||||
'fedora28'='rhel.7';
|
||||
'opensuse42.3'='linux-x64.tar.gz';
|
||||
'ubuntu16.04'='ubuntu.16.04';
|
||||
'ubuntu18.04'='ubuntu.18.04';
|
||||
'fxdependent-centos7'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-fedora28'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-ubuntu18.04'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-dotnetsdk-latest'='linux-x64-fxd-dotnetsdk.tar.gz'
|
||||
}
|
||||
}
|
||||
|
||||
# Function defines a config mapping for testing Stable packages.
|
||||
# The list of supported OS for each release can be found here:
|
||||
# https://github.com/PowerShell/PowerShell-Docs/blob/staging/reference/docs-conceptual/PowerShell-Core-Support.md#supported-platforms
|
||||
function Get-DefaultStableConfigForPackageValidation
|
||||
{
|
||||
# format: <DockerfileFolderName>=<PartOfPackageFilename>
|
||||
@{ 'centos7'='rhel.7';
|
||||
'debian.9'='debian.9';
|
||||
'opensuse42.3'='linux-x64.tar.gz';
|
||||
'ubuntu16.04'='ubuntu.16.04';
|
||||
'fxdependent-centos7'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-debian.9'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-opensuse42.3'='linux-x64-fxdependent.tar.gz';
|
||||
'fxdependent-ubuntu16.04'='linux-x64-fxdependent.tar.gz'
|
||||
}
|
||||
}
|
||||
|
||||
# Returns a list of files in a specified Azure container.
|
||||
function Get-PackageNamesOnAzureBlob
|
||||
{
|
||||
param(
|
||||
[string]
|
||||
$ContainerUrl,
|
||||
|
||||
# $SAS (shared access signature) param should include beginning '?' and trailing '&'
|
||||
[string]
|
||||
$SAS
|
||||
)
|
||||
|
||||
|
||||
$response = Invoke-RestMethod -Method Get -Uri $($ContainerUrl + $SAS + 'restype=container&comp=list')
|
||||
|
||||
$xmlResponce = [xml]$response.Substring($response.IndexOf('<EnumerationResults')) # remove some bad chars in the beginning that break XML parsing
|
||||
($xmlResponce.EnumerationResults.Blobs.Blob).Name
|
||||
}
|
||||
|
||||
# This function is used for basic validation of PS packages during a release;
|
||||
# During the process Docker files are filled out and executed with Docker build;
|
||||
# During the build PS packages are downloaded onto Docker containers, installed and selected Pester tests from PowerShell Github repo are executed.
|
||||
# This function must be run on a Docker host machine in 'Linux containers' mode, such as Windows 10 server with Hyper-V role installed.
|
||||
function Test-PSPackage
|
||||
{
|
||||
param(
|
||||
[string]
|
||||
[Parameter(Mandatory=$true)]
|
||||
$PSPackageLocation, # e.g. Azure container storage url
|
||||
[string]
|
||||
$SAS,# $SAS (shared access signature) param should include beginning '?' and trailing '&'
|
||||
[Hashtable]
|
||||
$Config, # hashtable that maps packages to dockerfiles; for example see Get-DefaultConfigForPackageValidation
|
||||
[string]
|
||||
$TestList = "/PowerShell/test/powershell/Modules/PackageManagement/PackageManagement.Tests.ps1,/PowerShell/test/powershell/engine/Module",
|
||||
[string]
|
||||
$TestDownloadCommand = "git clone --recursive https://github.com/PowerShell/PowerShell.git",
|
||||
[switch]
|
||||
$Preview = $false
|
||||
)
|
||||
|
||||
$PSPackageLocation = $PSPackageLocation.TrimEnd('/','\') # code below assumes there is no trailing separator in PSPackageLocation url
|
||||
$RootFolder = Join-Path $PSScriptRoot 'Templates'
|
||||
|
||||
|
||||
$packageList = Get-PackageNamesOnAzureBlob -ContainerUrl $PSPackageLocation -SAS $SAS
|
||||
if (!$Config)
|
||||
{
|
||||
if ($Preview)
|
||||
{
|
||||
$Config = Get-DefaultPreviewConfigForPackageValidation
|
||||
}
|
||||
else
|
||||
{
|
||||
$Config = Get-DefaultStableConfigForPackageValidation
|
||||
}
|
||||
}
|
||||
|
||||
# pre-process $Config: verify build directories and packages exist
|
||||
$map = @{}
|
||||
foreach($kp in $Config.GetEnumerator())
|
||||
{
|
||||
$buildDir = Join-Path $RootFolder $kp.Key
|
||||
$packageName = $packageList | Where-Object {$_ -like $('*'+$kp.Value+'*')}
|
||||
|
||||
if (-not (Test-Path $buildDir))
|
||||
{
|
||||
Write-Error "Directory does Not exist - $buildDir; Check `$Config parameter and '$RootFolder' folder"
|
||||
}
|
||||
elseif (-not ($packageName))
|
||||
{
|
||||
Write-Error "Can not find package that matches filter *$($kp.Value)*; Check `$Config parameter and '$PSPackageLocation'"
|
||||
}
|
||||
else
|
||||
{
|
||||
$map.Add($buildDir, $packageName)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Using configuration:" -Verbose
|
||||
Write-Verbose ($map | Format-List | Out-String) -Verbose
|
||||
|
||||
$results = @{}
|
||||
$returnValue = $true
|
||||
|
||||
# run builds sequentially, but don't block for errors so that configs after failed one can run
|
||||
foreach($kp in $map.GetEnumerator())
|
||||
{
|
||||
$dockerDirPath = $kp.Key
|
||||
$packageFileName = $kp.Value
|
||||
|
||||
$buildArgs = @()
|
||||
|
||||
$buildArgs += "--build-arg","PACKAGENAME=$packageFileName"
|
||||
$buildArgs += "--build-arg","PACKAGELOCATION=$PSPackageLocation"
|
||||
if ($Preview)
|
||||
{
|
||||
$buildArgs += "--build-arg","PREVIEWSUFFIX=-preview"
|
||||
}
|
||||
$buildArgs += "--build-arg","TESTLIST=$TestList"
|
||||
$buildArgs += "--build-arg","TESTDOWNLOADCOMMAND=$TestDownloadCommand"
|
||||
$buildArgs += "--no-cache"
|
||||
$buildArgs += $dockerDirPath
|
||||
|
||||
$dockerResult = Invoke-Docker -Command 'build' -Params $buildArgs -FailureAction warning
|
||||
|
||||
$confName = Split-Path -Leaf $dockerDirPath
|
||||
$results.Add($confName, $dockerResult)
|
||||
if (-not $dockerResult) {$returnValue = $false}
|
||||
}
|
||||
|
||||
# in the end print results for all configurations
|
||||
Write-Verbose "Package validation results:" -Verbose
|
||||
$results
|
||||
|
||||
return $returnValue
|
||||
}
|
@ -18,8 +18,7 @@ refer to the [Working with the PowerShell Repository](../git/README.md),
|
||||
|
||||
### Toolchain Setup
|
||||
|
||||
We use the [.NET Command-Line Interface][dotnet-cli] (`dotnet`) to build the managed components,
|
||||
and [CMake][] to build the native components.
|
||||
We use the [.NET Command-Line Interface][dotnet-cli] (`dotnet`) to build the managed components.
|
||||
|
||||
Installing the toolchain is as easy as running `Start-PSBootstrap` in PowerShell.
|
||||
Of course, this requires a self-hosted copy of PowerShell on Linux.
|
||||
@ -55,7 +54,6 @@ The `Start-PSBootstrap` function does the following:
|
||||
If you want to use `dotnet` outside of `Start-PSBuild`, add `~/.dotnet` to your `PATH` environment variable.
|
||||
|
||||
[dotnet-cli]: https://docs.microsoft.com/dotnet/core/tools/
|
||||
[CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html
|
||||
|
||||
## Build using our module
|
||||
|
||||
|
@ -14,7 +14,7 @@ From `pwsh.exe`, run `Import-Module ./build.psm1` and use `Start-PSBootstrap` to
|
||||
|
||||
The `Start-PSBootstrap` function does the following:
|
||||
|
||||
- Uses `brew` or `port` to install CMake, OpenSSL, and GNU WGet
|
||||
- Uses `brew` or `port` to install OpenSSL, and GNU WGet
|
||||
- Uninstalls any prior versions of .NET CLI
|
||||
- Downloads and installs .NET Core SDK to `~/.dotnet`
|
||||
|
||||
|
15
experimental-feature-linux.json
Normal file
15
experimental-feature-linux.json
Normal file
@ -0,0 +1,15 @@
|
||||
[
|
||||
"PSAMSIMethodInvocationLogging",
|
||||
"PSAnsiRenderingFileInfo",
|
||||
"PSCleanBlock",
|
||||
"PSCommandNotFoundSuggestion",
|
||||
"PSExec",
|
||||
"PSLoadAssemblyFromNativeCode",
|
||||
"PSNativeCommandArgumentPassing",
|
||||
"PSNativeCommandErrorActionPreference",
|
||||
"PSNativePSPathResolution",
|
||||
"PSSubsystemPluginModel",
|
||||
"PSModuleAutoLoadSkipOfflineFiles",
|
||||
"PSFeedbackProvider",
|
||||
"PSCommandWithArgs"
|
||||
]
|
15
experimental-feature-windows.json
Normal file
15
experimental-feature-windows.json
Normal file
@ -0,0 +1,15 @@
|
||||
[
|
||||
"PSAMSIMethodInvocationLogging",
|
||||
"PSAnsiRenderingFileInfo",
|
||||
"PSCleanBlock",
|
||||
"PSCommandNotFoundSuggestion",
|
||||
"PSExec",
|
||||
"PSLoadAssemblyFromNativeCode",
|
||||
"PSNativeCommandArgumentPassing",
|
||||
"PSNativeCommandErrorActionPreference",
|
||||
"PSNativePSPathResolution",
|
||||
"PSSubsystemPluginModel",
|
||||
"PSModuleAutoLoadSkipOfflineFiles",
|
||||
"PSFeedbackProvider",
|
||||
"PSCommandWithArgs"
|
||||
]
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "6.0.100-rc.1.21458.32"
|
||||
"version": "6.0.410"
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@
|
||||
<clear />
|
||||
<add key="dotnet" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v2" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="dotnet-internal" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rc.1.21430.44-shipping/nuget/v2" />
|
||||
<add key="dotnet-internal" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/6.0.100-rtm.21524.1-shipping/nuget/v2" />
|
||||
</packageSources>
|
||||
<disabledPackageSources>
|
||||
<clear />
|
||||
</disabledPackageSources>
|
||||
</configuration>
|
||||
|
||||
|
||||
|
11
prquantifier.yaml
Normal file
11
prquantifier.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
# https://github.com/microsoft/PullRequestQuantifier/blob/main/docs/prquantifier-yaml.md
|
||||
Excluded:
|
||||
# defaults
|
||||
- '*.csproj'
|
||||
- prquantifier.yaml
|
||||
- package-lock.json
|
||||
- '*.md'
|
||||
- '*.sln'
|
||||
# autogenerated files
|
||||
- tools/cgmanifest.json
|
||||
- assets/wix/files.wxs
|
@ -47,7 +47,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -306,7 +306,7 @@ foreach ($computerName in $array[1])
|
||||
ComputerName = $computerName
|
||||
ScriptBlock = { $true }
|
||||
|
||||
SessionOption = NewPSSessionOption -NoMachineProfile
|
||||
SessionOption = New-PSSessionOption -NoMachineProfile
|
||||
ErrorAction = 'SilentlyContinue'
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Markdig.Signed" Version="0.31.0" />
|
||||
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="6.0.1" />
|
||||
<PackageReference Include="Namotion.Reflection" Version="2.0.10" />
|
||||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.0-preview.2" />
|
||||
<PackageReference Include="Microsoft.PowerShell.MarkdownRender" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -31,9 +34,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-4.final" />
|
||||
<PackageReference Include="System.Threading.AccessControl" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
|
||||
<PackageReference Include="System.Threading.AccessControl" Version="6.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="NJsonSchema" Version="10.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -11,6 +11,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Internal;
|
||||
using System.Management.Automation.Security;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using System.Security;
|
||||
@ -549,8 +550,10 @@ namespace Microsoft.PowerShell.Commands
|
||||
/// </summary>
|
||||
protected override void BeginProcessing()
|
||||
{
|
||||
// Prevent code compilation in ConstrainedLanguage mode
|
||||
if (SessionState.LanguageMode == PSLanguageMode.ConstrainedLanguage)
|
||||
// Prevent code compilation in ConstrainedLanguage mode, or NoLanguage mode under system lock down.
|
||||
if (SessionState.LanguageMode == PSLanguageMode.ConstrainedLanguage ||
|
||||
(SessionState.LanguageMode == PSLanguageMode.NoLanguage &&
|
||||
SystemPolicy.GetSystemLockdownPolicy() == SystemEnforcementMode.Enforce))
|
||||
{
|
||||
ThrowTerminatingError(
|
||||
new ErrorRecord(
|
||||
|
@ -71,7 +71,13 @@ namespace Microsoft.PowerShell.Commands
|
||||
if (ShouldProcess(dateToUse.ToString()))
|
||||
{
|
||||
#if UNIX
|
||||
if (!Platform.NonWindowsSetDate(dateToUse))
|
||||
// We are not validating the native call here.
|
||||
// We just want to be sure that we're using the value the user provided us.
|
||||
if (Dbg.Internal.InternalTestHooks.SetDate)
|
||||
{
|
||||
WriteObject(dateToUse);
|
||||
}
|
||||
else if (!Platform.NonWindowsSetDate(dateToUse))
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
@ -86,16 +92,23 @@ namespace Microsoft.PowerShell.Commands
|
||||
systemTime.Second = (ushort)dateToUse.Second;
|
||||
systemTime.Milliseconds = (ushort)dateToUse.Millisecond;
|
||||
#pragma warning disable 56523
|
||||
if (!NativeMethods.SetLocalTime(ref systemTime))
|
||||
if (Dbg.Internal.InternalTestHooks.SetDate)
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
WriteObject(systemTime);
|
||||
}
|
||||
|
||||
// MSDN says to call this twice to account for changes
|
||||
// between DST
|
||||
if (!NativeMethods.SetLocalTime(ref systemTime))
|
||||
else
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
if (!NativeMethods.SetLocalTime(ref systemTime))
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
|
||||
// MSDN says to call this twice to account for changes
|
||||
// between DST
|
||||
if (!NativeMethods.SetLocalTime(ref systemTime))
|
||||
{
|
||||
throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
}
|
||||
}
|
||||
#pragma warning restore 56523
|
||||
#endif
|
||||
@ -106,7 +119,11 @@ namespace Microsoft.PowerShell.Commands
|
||||
PSNoteProperty note = new("DisplayHint", DisplayHint);
|
||||
outputObj.Properties.Add(note);
|
||||
|
||||
WriteObject(outputObj);
|
||||
// If we've turned on the SetDate test hook, don't emit the output object here because we emitted it earlier.
|
||||
if (!Dbg.Internal.InternalTestHooks.SetDate)
|
||||
{
|
||||
WriteObject(outputObj);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -1260,9 +1260,15 @@ namespace Microsoft.PowerShell.Commands
|
||||
}
|
||||
}
|
||||
|
||||
// Add the content headers
|
||||
if (request.Content == null)
|
||||
// For other methods like Put where empty content has meaning, we need to fill in the content
|
||||
if (request.Content is null)
|
||||
{
|
||||
// If this is a Get request and there is no content, then don't fill in the content as empty content gets rejected by some web services per RFC7230
|
||||
if ((IsStandardMethodSet() && request.Method == HttpMethod.Get && ContentType is null) || (IsCustomMethodSet() && CustomMethod.ToUpperInvariant() == "GET"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
request.Content = new StringContent(string.Empty);
|
||||
request.Content.Headers.Clear();
|
||||
}
|
||||
|
@ -289,16 +289,14 @@ namespace Microsoft.PowerShell.Commands
|
||||
ActivityId,
|
||||
WebCmdletStrings.WriteRequestProgressActivity,
|
||||
WebCmdletStrings.WriteRequestProgressStatus);
|
||||
|
||||
try
|
||||
{
|
||||
do
|
||||
while (!copyTask.Wait(1000, cancellationToken))
|
||||
{
|
||||
record.StatusDescription = StringUtil.Format(WebCmdletStrings.WriteRequestProgressStatus, output.Position);
|
||||
cmdlet.WriteProgress(record);
|
||||
|
||||
Task.Delay(1000).Wait(cancellationToken);
|
||||
}
|
||||
while (!copyTask.IsCompleted && !cancellationToken.IsCancellationRequested);
|
||||
|
||||
if (copyTask.IsCompleted)
|
||||
{
|
||||
|
@ -432,7 +432,7 @@ namespace Microsoft.PowerShell
|
||||
host.ShouldEndSession = shouldEndSession;
|
||||
}
|
||||
|
||||
// Creation of the tread and starting it should be an atomic operation.
|
||||
// Creation of the thread and starting it should be an atomic operation.
|
||||
// otherwise the code in Run method can get instance of the breakhandlerThread
|
||||
// after it is created and before started and call join on it. This will result
|
||||
// in ThreadStateException.
|
||||
|
@ -729,7 +729,7 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
|
||||
TextWriter writer = Console.IsOutputRedirected ? Console.Out : _parent.ConsoleTextWriter;
|
||||
value = GetOutputString(value, SupportsVirtualTerminal, Console.IsOutputRedirected);
|
||||
value = GetOutputString(value, SupportsVirtualTerminal);
|
||||
|
||||
if (_parent.IsRunningAsync)
|
||||
{
|
||||
@ -1215,7 +1215,7 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
if (SupportsVirtualTerminal)
|
||||
{
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Debug, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message) + PSStyle.Instance.Reset);
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Debug) + StringUtil.Format(ConsoleHostUserInterfaceStrings.DebugFormatString, message) + PSStyle.Instance.Reset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1276,7 +1276,7 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
if (SupportsVirtualTerminal)
|
||||
{
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Verbose, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message) + PSStyle.Instance.Reset);
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Verbose) + StringUtil.Format(ConsoleHostUserInterfaceStrings.VerboseFormatString, message) + PSStyle.Instance.Reset);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1320,7 +1320,7 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
if (SupportsVirtualTerminal)
|
||||
{
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Warning, Console.IsOutputRedirected) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message) + PSStyle.Instance.Reset);
|
||||
WriteLine(GetFormatStyleString(FormatStyle.Warning) + StringUtil.Format(ConsoleHostUserInterfaceStrings.WarningFormatString, message) + PSStyle.Instance.Reset);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Diagnostics.EventLog" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -6,6 +6,7 @@
|
||||
<AssemblyName>Microsoft.PowerShell.GlobalTool.Shim</AssemblyName>
|
||||
<OutputType>EXE</OutputType>
|
||||
<RootNamespace>Microsoft.PowerShell.GlobalTool.Shim</RootNamespace>
|
||||
<UseAppHost>False</UseAppHost>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" Condition="'$(SDKToUse)' == 'Microsoft.NET.Sdk' " />
|
||||
|
@ -16,21 +16,22 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!-- the following package(s) are from https://github.com/dotnet/fxdac -->
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.17" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
||||
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
|
||||
<PackageReference Include="System.IO.Packaging" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.IO.Packaging" Version="6.0.0" />
|
||||
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="6.0.1" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
|
||||
<!-- the following package(s) are from https://github.com/dotnet/wcf -->
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.Private.ServiceModel" Version="4.9.0-preview1.21220.1" />
|
||||
<PackageReference Include="System.ServiceModel.Duplex" Version="4.9.0" />
|
||||
<PackageReference Include="System.ServiceModel.Http" Version="4.9.0" />
|
||||
<PackageReference Include="System.ServiceModel.NetTcp" Version="4.9.0" />
|
||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.9.0" />
|
||||
<PackageReference Include="System.ServiceModel.Security" Version="4.9.0" />
|
||||
<PackageReference Include="System.Private.ServiceModel" Version="4.9.0" />
|
||||
<!-- the source could not be found for the following package(s) -->
|
||||
<PackageReference Include="Microsoft.NETCore.Windows.ApiSets" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<ProjectReference Include="..\System.Management.Automation\System.Management.Automation.csproj" />
|
||||
<ProjectReference Include="..\Microsoft.WSMan.Runtime\Microsoft.WSMan.Runtime.csproj" />
|
||||
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -10,5 +10,5 @@ FunctionsToExport = @()
|
||||
CmdletsToExport="Start-Transcript", "Stop-Transcript"
|
||||
AliasesToExport = @()
|
||||
NestedModules="Microsoft.PowerShell.ConsoleHost.dll"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ ModuleVersion="7.0.0.0"
|
||||
CompatiblePSEditions = @("Core")
|
||||
PowerShellVersion="3.0"
|
||||
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
FunctionsToExport = @()
|
||||
AliasesToExport = @("gcb", "gtz", "scb")
|
||||
CmdletsToExport=@("Add-Content",
|
||||
|
@ -10,5 +10,5 @@ FunctionsToExport = @()
|
||||
CmdletsToExport="Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-PfxCertificate" , "Protect-CmsMessage", "Unprotect-CmsMessage", "Get-CmsMessage"
|
||||
AliasesToExport = @()
|
||||
NestedModules="Microsoft.PowerShell.Security.dll"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -30,19 +30,5 @@ CmdletsToExport = @(
|
||||
FunctionsToExport = @()
|
||||
AliasesToExport = @('fhx')
|
||||
NestedModules = @("Microsoft.PowerShell.Commands.Utility.dll")
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
PrivateData = @{
|
||||
PSData = @{
|
||||
ExperimentalFeatures = @(
|
||||
@{
|
||||
Name = 'Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace'
|
||||
Description = 'Enables -BreakAll parameter on Debug-Runspace and Debug-Job cmdlets to allow users to decide if they want PowerShell to break immediately in the current location when they attach a debugger. Enables -Runspace parameter on *-PSBreakpoint cmdlets to support management of breakpoints in another runspace.'
|
||||
}
|
||||
@{
|
||||
Name = 'Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck'
|
||||
Description = 'Enable -SkipLimitCheck switch for Import-PowerShellDataFile to not enforce built-in hashtable limits'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -14,5 +14,5 @@ CmdletsToExport= "Get-CimAssociatedInstance", "Get-CimClass", "Get-CimInstance",
|
||||
"Remove-CimSession","Set-CimInstance",
|
||||
"Export-BinaryMiLog","Import-BinaryMiLog"
|
||||
AliasesToExport = "gcim","scim","ncim", "rcim","icim","gcai","rcie","ncms","rcms","gcms","ncso","gcls"
|
||||
HelpInfoUri="https://aka.ms/powershell71-help"
|
||||
HelpInfoUri="https://aka.ms/powershell72-help"
|
||||
}
|
||||
|
@ -12,5 +12,5 @@ AliasesToExport = @()
|
||||
NestedModules="Microsoft.PowerShell.Commands.Diagnostics.dll"
|
||||
TypesToProcess="GetEvent.types.ps1xml"
|
||||
FormatsToProcess="Event.format.ps1xml", "Diagnostics.format.ps1xml"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ ModuleVersion="7.0.0.0"
|
||||
CompatiblePSEditions = @("Core")
|
||||
PowerShellVersion="3.0"
|
||||
NestedModules="Microsoft.PowerShell.Commands.Management.dll"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
FunctionsToExport = @()
|
||||
AliasesToExport = @("gcb", "gin", "gtz", "scb", "stz")
|
||||
CmdletsToExport=@("Add-Content",
|
||||
|
@ -10,5 +10,5 @@ FunctionsToExport = @()
|
||||
CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog"
|
||||
AliasesToExport = @()
|
||||
NestedModules="Microsoft.PowerShell.Security.dll"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -29,19 +29,5 @@ CmdletsToExport = @(
|
||||
FunctionsToExport = @()
|
||||
AliasesToExport = @('fhx')
|
||||
NestedModules = @("Microsoft.PowerShell.Commands.Utility.dll")
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
PrivateData = @{
|
||||
PSData = @{
|
||||
ExperimentalFeatures = @(
|
||||
@{
|
||||
Name = 'Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace'
|
||||
Description = 'Enables -BreakAll parameter on Debug-Runspace and Debug-Job cmdlets to allow users to decide if they want PowerShell to break immediately in the current location when they attach a debugger. Enables -Runspace parameter on *-PSBreakpoint cmdlets to support management of breakpoints in another runspace.'
|
||||
}
|
||||
@{
|
||||
Name = 'Microsoft.PowerShell.Utility.PSImportPSDataFileSkipLimitCheck'
|
||||
Description = 'Enable -NoLimit switch for Import-PowerShellDataFile to not enforce built-in hashtable limits'
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -11,5 +11,5 @@ CmdletsToExport="Disable-WSManCredSSP", "Enable-WSManCredSSP", "Get-WSManCredSSP
|
||||
AliasesToExport = @()
|
||||
NestedModules="Microsoft.WSMan.Management.dll"
|
||||
FormatsToProcess="WSMan.format.ps1xml"
|
||||
HelpInfoURI = 'https://aka.ms/powershell71-help'
|
||||
HelpInfoURI = 'https://aka.ms/powershell72-help'
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
FunctionsToExport="Disable-PSTrace","Disable-PSWSManCombinedTrace","Disable-WSManTrace","Enable-PSTrace","Enable-PSWSManCombinedTrace","Enable-WSManTrace","Get-LogProperties","Set-LogProperties","Start-Trace","Stop-Trace"
|
||||
CmdletsToExport = @()
|
||||
AliasesToExport = @()
|
||||
HelpInfoUri="https://aka.ms/powershell71-help"
|
||||
HelpInfoUri="https://aka.ms/powershell72-help"
|
||||
}
|
||||
|
@ -232,6 +232,9 @@ namespace System.Management.Automation
|
||||
/// |
|
||||
/// |--- 'osx-x64' subfolder
|
||||
/// | |--- native.dylib
|
||||
/// |
|
||||
/// |--- 'osx-arm64' subfolder
|
||||
/// | |--- native.dylib
|
||||
/// </summary>
|
||||
internal static IntPtr NativeDllHandler(Assembly assembly, string libraryName)
|
||||
{
|
||||
@ -362,14 +365,14 @@ namespace System.Management.Automation
|
||||
|
||||
if (!assemblyFound)
|
||||
{
|
||||
string gacBitnessAwarePath = null;
|
||||
string gacBitnessAwarePath;
|
||||
|
||||
if (Environment.Is64BitProcess)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_gacPath64))
|
||||
{
|
||||
// cache value of '_gacPath64' folder in member variable.
|
||||
_gacPath64 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_64";
|
||||
var gacName = RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "GAC_Arm64" : "GAC_64";
|
||||
_gacPath64 = Path.Join(_winDir, "Microsoft.NET", "assembly", gacName);
|
||||
}
|
||||
|
||||
gacBitnessAwarePath = _gacPath64;
|
||||
@ -378,8 +381,7 @@ namespace System.Management.Automation
|
||||
{
|
||||
if (string.IsNullOrEmpty(_gacPath32))
|
||||
{
|
||||
// cache value of '_gacPath32' folder in member variable.
|
||||
_gacPath32 = $"{_winDir}{dirSeparator}Microsoft.NET{dirSeparator}assembly{dirSeparator}GAC_32";
|
||||
_gacPath32 = Path.Join(_winDir, "Microsoft.NET", "assembly", "GAC_32");
|
||||
}
|
||||
|
||||
gacBitnessAwarePath = _gacPath32;
|
||||
@ -552,7 +554,7 @@ namespace System.Management.Automation
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
folderName = "osx-x64";
|
||||
folderName = "osx-" + processArch;
|
||||
ext = ".dylib";
|
||||
}
|
||||
|
||||
|
@ -516,11 +516,6 @@ namespace System.Management.Automation
|
||||
return Unix.IsHardLink(fileInfo);
|
||||
}
|
||||
|
||||
internal static string NonWindowsInternalGetTarget(string path)
|
||||
{
|
||||
return Unix.NativeMethods.FollowSymLink(path);
|
||||
}
|
||||
|
||||
internal static string NonWindowsGetUserFromPid(int path)
|
||||
{
|
||||
return Unix.NativeMethods.GetUserFromPid(path);
|
||||
|
@ -811,33 +811,18 @@ namespace System.Management.Automation.Runspaces
|
||||
$ellipsis = ""`u{2026}""
|
||||
$resetColor = ''
|
||||
$errorColor = ''
|
||||
$accentColor = ''
|
||||
|
||||
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
|
||||
if ($null -ne $psstyle) {
|
||||
$errorColor = $psstyle.Formatting.Error
|
||||
}
|
||||
|
||||
$resetColor = [System.Management.Automation.VTUtility]::GetEscapeSequence(
|
||||
[System.Management.Automation.VTUtility+VT]::Reset
|
||||
)
|
||||
}
|
||||
|
||||
function Get-VT100Color([ConsoleColor] $color) {
|
||||
if (!$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return [System.Management.Automation.VTUtility]::GetEscapeSequence($color)
|
||||
$resetColor = $PSStyle.Reset
|
||||
$errorColor = $psstyle.Formatting.Error
|
||||
$accentColor = $PSStyle.Formatting.FormatAccent
|
||||
}
|
||||
|
||||
function Show-ErrorRecord($obj, [int]$indent = 0, [int]$depth = 1) {
|
||||
$newline = [Environment]::Newline
|
||||
$output = [System.Text.StringBuilder]::new()
|
||||
$prefix = ' ' * $indent
|
||||
$accentColor = ''
|
||||
|
||||
if ($null -ne $Host.PrivateData) {
|
||||
$accentColor = Get-VT100Color ($Host.PrivateData.FormatAccentColor ?? $Host.PrivateData.ErrorForegroundColor)
|
||||
}
|
||||
|
||||
$expandTypes = @(
|
||||
'Microsoft.Rest.HttpRequestMessageWrapper'
|
||||
@ -1066,37 +1051,18 @@ namespace System.Management.Automation.Runspaces
|
||||
Set-StrictMode -Off
|
||||
$newline = [Environment]::Newline
|
||||
|
||||
$resetColor = ''
|
||||
$errorColor = ''
|
||||
$accentColor = ''
|
||||
|
||||
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
|
||||
$resetColor = $PSStyle.Reset
|
||||
$errorColor = $PSStyle.Formatting.Error
|
||||
$accentColor = $PSStyle.Formatting.ErrorAccent
|
||||
}
|
||||
|
||||
function Get-ConciseViewPositionMessage {
|
||||
|
||||
$resetColor = ''
|
||||
if ($Host.UI.SupportsVirtualTerminal -and ([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
|
||||
$resetColor = [System.Management.Automation.VTUtility]::GetEscapeSequence(
|
||||
[System.Management.Automation.VTUtility+VT]::Reset
|
||||
)
|
||||
}
|
||||
|
||||
function Get-VT100Color([ConsoleColor] $color) {
|
||||
if (!$Host.UI.SupportsVirtualTerminal -or !([string]::IsNullOrEmpty($env:__SuppressAnsiEscapeSequences))) {
|
||||
return ''
|
||||
}
|
||||
|
||||
return [System.Management.Automation.VTUtility]::GetEscapeSequence($color)
|
||||
}
|
||||
|
||||
# return length of string sans VT100 codes
|
||||
function Get-RawStringLength($string) {
|
||||
$vtCodes = ""`e[0m"", ""`e[2;30m"", ""`e[2;31m"", ""`e[2;32m"", ""`e[2;33m"", ""`e[2;34m"",
|
||||
""`e[2;35m"", ""`e[2;36m"", ""`e[2;37m"", ""`e[1;30m"", ""`e[1;31m"", ""`e[1;32m"",
|
||||
""`e[1;33m"", ""`e[1;34m"", ""`e[1;35m"", ""`e[1;36m"", ""`e[1;37m""
|
||||
|
||||
$newString = $string
|
||||
foreach ($vtCode in $vtCodes) {
|
||||
$newString = $newString.Replace($vtCode, '')
|
||||
}
|
||||
|
||||
return $newString.Length
|
||||
}
|
||||
|
||||
# returns a string cut to last whitespace
|
||||
function Get-TruncatedString($string, [int]$length) {
|
||||
|
||||
@ -1107,14 +1073,6 @@ namespace System.Management.Automation.Runspaces
|
||||
return ($string.Substring(0,$length) -split '\s',-2)[0]
|
||||
}
|
||||
|
||||
$errorColor = ''
|
||||
$accentColor = ''
|
||||
|
||||
if ($null -ne $Host.PrivateData) {
|
||||
$errorColor = Get-VT100Color $Host.PrivateData.ErrorForegroundColor
|
||||
$accentColor = Get-VT100Color ($Host.PrivateData.ErrorAccentColor ?? $errorColor)
|
||||
}
|
||||
|
||||
$posmsg = ''
|
||||
$headerWhitespace = ''
|
||||
$offsetWhitespace = ''
|
||||
@ -1217,7 +1175,7 @@ namespace System.Management.Automation.Runspaces
|
||||
|
||||
# if rendering line information, break up the message if it's wider than the console
|
||||
if ($myinv -and $myinv.ScriptName -or $err.CategoryInfo.Category -eq 'ParserError') {
|
||||
$prefixLength = Get-RawStringLength -string $prefix
|
||||
$prefixLength = [System.Management.Automation.Internal.StringDecorated]::new($prefix).ContentLength
|
||||
$prefixVtLength = $prefix.Length - $prefixLength
|
||||
|
||||
# replace newlines in message so it lines up correct
|
||||
@ -1297,71 +1255,76 @@ namespace System.Management.Automation.Runspaces
|
||||
}
|
||||
|
||||
if ($err.FullyQualifiedErrorId -eq 'NativeCommandErrorMessage' -or $err.FullyQualifiedErrorId -eq 'NativeCommandError') {
|
||||
$err.Exception.Message
|
||||
return ""${errorColor}$($err.Exception.Message)${resetcolor}""
|
||||
}
|
||||
|
||||
$myinv = $err.InvocationInfo
|
||||
if ($ErrorView -eq 'DetailedView') {
|
||||
$message = Get-Error | Out-String
|
||||
return ""${errorColor}${message}${resetcolor}""
|
||||
}
|
||||
|
||||
if ($ErrorView -eq 'CategoryView') {
|
||||
$message = $err.CategoryInfo.GetMessage()
|
||||
return ""${errorColor}${message}${resetcolor}""
|
||||
}
|
||||
|
||||
$posmsg = ''
|
||||
if ($ErrorView -eq 'ConciseView') {
|
||||
$posmsg = Get-ConciseViewPositionMessage
|
||||
}
|
||||
elseif ($myinv -and ($myinv.MyCommand -or ($err.CategoryInfo.Category -ne 'ParserError'))) {
|
||||
$posmsg = $myinv.PositionMessage
|
||||
}
|
||||
|
||||
if ($posmsg -ne '') {
|
||||
$posmsg = $newline + $posmsg
|
||||
}
|
||||
|
||||
if ($err.PSMessageDetails) {
|
||||
$posmsg = ' : ' + $err.PSMessageDetails + $posmsg
|
||||
}
|
||||
|
||||
if ($ErrorView -eq 'ConciseView') {
|
||||
if ($err.PSMessageDetails) {
|
||||
$posmsg = ""${errorColor}${posmsg}""
|
||||
}
|
||||
return $posmsg
|
||||
}
|
||||
|
||||
$indent = 4
|
||||
|
||||
$errorCategoryMsg = $err.ErrorCategory_Message
|
||||
|
||||
if ($null -ne $errorCategoryMsg)
|
||||
{
|
||||
$indentString = '+ CategoryInfo : ' + $err.ErrorCategory_Message
|
||||
}
|
||||
else
|
||||
{
|
||||
$myinv = $err.InvocationInfo
|
||||
if ($ErrorView -eq 'DetailedView') {
|
||||
return (Get-Error | Out-String)
|
||||
}
|
||||
elseif ($ErrorView -eq 'ConciseView') {
|
||||
$posmsg = Get-ConciseViewPositionMessage
|
||||
}
|
||||
elseif ($myinv -and ($myinv.MyCommand -or ($err.CategoryInfo.Category -ne 'ParserError'))) {
|
||||
$posmsg = $myinv.PositionMessage
|
||||
} else {
|
||||
$posmsg = ''
|
||||
}
|
||||
|
||||
if ($posmsg -ne '')
|
||||
{
|
||||
$posmsg = $newline + $posmsg
|
||||
}
|
||||
|
||||
if ($err.PSMessageDetails) {
|
||||
$posmsg = ' : ' + $err.PSMessageDetails + $posmsg
|
||||
}
|
||||
|
||||
if ($ErrorView -eq 'ConciseView') {
|
||||
return $posmsg
|
||||
}
|
||||
|
||||
$indent = 4
|
||||
|
||||
$errorCategoryMsg = $err.ErrorCategory_Message
|
||||
|
||||
if ($null -ne $errorCategoryMsg)
|
||||
{
|
||||
$indentString = '+ CategoryInfo : ' + $err.ErrorCategory_Message
|
||||
}
|
||||
else
|
||||
{
|
||||
$indentString = '+ CategoryInfo : ' + $err.CategoryInfo
|
||||
}
|
||||
|
||||
$posmsg += $newline + $indentString
|
||||
|
||||
$indentString = ""+ FullyQualifiedErrorId : "" + $err.FullyQualifiedErrorId
|
||||
$posmsg += $newline + $indentString
|
||||
|
||||
$originInfo = $err.OriginInfo
|
||||
|
||||
if (($null -ne $originInfo) -and ($null -ne $originInfo.PSComputerName))
|
||||
{
|
||||
$indentString = ""+ PSComputerName : "" + $originInfo.PSComputerName
|
||||
$posmsg += $newline + $indentString
|
||||
}
|
||||
|
||||
if ($ErrorView -eq 'CategoryView') {
|
||||
$err.CategoryInfo.GetMessage()
|
||||
}
|
||||
elseif (! $err.ErrorDetails -or ! $err.ErrorDetails.Message) {
|
||||
$err.Exception.Message + $posmsg
|
||||
} else {
|
||||
$err.ErrorDetails.Message + $posmsg
|
||||
}
|
||||
$indentString = '+ CategoryInfo : ' + $err.CategoryInfo
|
||||
}
|
||||
|
||||
$posmsg += $newline + $indentString
|
||||
|
||||
$indentString = ""+ FullyQualifiedErrorId : "" + $err.FullyQualifiedErrorId
|
||||
$posmsg += $newline + $indentString
|
||||
|
||||
$originInfo = $err.OriginInfo
|
||||
|
||||
if (($null -ne $originInfo) -and ($null -ne $originInfo.PSComputerName))
|
||||
{
|
||||
$indentString = ""+ PSComputerName : "" + $originInfo.PSComputerName
|
||||
$posmsg += $newline + $indentString
|
||||
}
|
||||
|
||||
$finalMsg = if ($err.ErrorDetails.Message) {
|
||||
$err.ErrorDetails.Message + $posmsg
|
||||
} else {
|
||||
$err.Exception.Message + $posmsg
|
||||
}
|
||||
|
||||
""${errorColor}${finalMsg}${resetcolor}""
|
||||
")
|
||||
.EndEntry()
|
||||
.EndControl());
|
||||
@ -2082,37 +2045,37 @@ namespace System.Management.Automation.Runspaces
|
||||
.AddItemScriptBlock(@"""$($_.FileInfo.Executable)$($_.FileInfo.Executable.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "FileInfo.Executable")
|
||||
.AddItemScriptBlock(@"""$([string]::Join(',',$_.FileInfo.Extension.Keys))""", label: "FileInfo.Extension")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Black)$($_.Foreground.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Black")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightBlack)$($_.Foreground.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightBlack")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.White)$($_.Foreground.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.White")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.DarkGray)$($_.Foreground.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.DarkGray")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightGray)$($_.Foreground.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightGray")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightWhite)$($_.Foreground.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightWhite")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Red)$($_.Foreground.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Red")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightRed)$($_.Foreground.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightRed)$($_.Foreground.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Magenta)$($_.Foreground.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Magenta")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightMagenta)$($_.Foreground.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightMagenta)$($_.Foreground.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Blue)$($_.Foreground.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Blue")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightBlue)$($_.Foreground.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightBlue)$($_.Foreground.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Cyan)$($_.Foreground.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Cyan")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightCyan)$($_.Foreground.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightCyan)$($_.Foreground.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Green)$($_.Foreground.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Green")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightGreen)$($_.Foreground.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightGreen)$($_.Foreground.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.Yellow)$($_.Foreground.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.Yellow")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.LightYellow)$($_.Foreground.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.LightYellow")
|
||||
.AddItemScriptBlock(@"""$($_.Foreground.BrightYellow)$($_.Foreground.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Foreground.BrightYellow")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Black)$($_.Background.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Black")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightBlack)$($_.Background.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightBlack")
|
||||
.AddItemScriptBlock(@"""$($_.Background.White)$($_.Background.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.White")
|
||||
.AddItemScriptBlock(@"""$($_.Background.DarkGray)$($_.Background.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.DarkGray")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightGray)$($_.Background.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightGray")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightWhite)$($_.Background.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightWhite")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Red)$($_.Background.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Red")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightRed)$($_.Background.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightRed)$($_.Background.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Magenta)$($_.Background.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Magenta")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightMagenta)$($_.Background.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightMagenta)$($_.Background.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Blue)$($_.Background.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Blue")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightBlue)$($_.Background.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightBlue)$($_.Background.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Cyan)$($_.Background.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Cyan")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightCyan)$($_.Background.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightCyan)$($_.Background.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Green)$($_.Background.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Green")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightGreen)$($_.Background.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightGreen)$($_.Background.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Background.Yellow)$($_.Background.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.Yellow")
|
||||
.AddItemScriptBlock(@"""$($_.Background.LightYellow)$($_.Background.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.LightYellow")
|
||||
.AddItemScriptBlock(@"""$($_.Background.BrightYellow)$($_.Background.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Background.BrightYellow")
|
||||
.EndEntry()
|
||||
.EndList());
|
||||
}
|
||||
@ -2185,46 +2148,46 @@ namespace System.Management.Automation.Runspaces
|
||||
ListControl.Create()
|
||||
.StartEntry()
|
||||
.AddItemScriptBlock(@"""$($_.Black)$($_.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Black")
|
||||
.AddItemScriptBlock(@"""$($_.BrightBlack)$($_.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlack")
|
||||
.AddItemScriptBlock(@"""$($_.White)$($_.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "White")
|
||||
.AddItemScriptBlock(@"""$($_.DarkGray)$($_.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "DarkGray")
|
||||
.AddItemScriptBlock(@"""$($_.LightGray)$($_.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGray")
|
||||
.AddItemScriptBlock(@"""$($_.BrightWhite)$($_.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightWhite")
|
||||
.AddItemScriptBlock(@"""$($_.Red)$($_.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Red")
|
||||
.AddItemScriptBlock(@"""$($_.LightRed)$($_.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightRed")
|
||||
.AddItemScriptBlock(@"""$($_.BrightRed)$($_.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Magenta)$($_.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Magenta")
|
||||
.AddItemScriptBlock(@"""$($_.LightMagenta)$($_.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.BrightMagenta)$($_.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Blue)$($_.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Blue")
|
||||
.AddItemScriptBlock(@"""$($_.LightBlue)$($_.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.BrightBlue)$($_.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Cyan)$($_.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Cyan")
|
||||
.AddItemScriptBlock(@"""$($_.LightCyan)$($_.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.BrightCyan)$($_.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Green)$($_.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Green")
|
||||
.AddItemScriptBlock(@"""$($_.LightGreen)$($_.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.BrightGreen)$($_.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Yellow)$($_.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Yellow")
|
||||
.AddItemScriptBlock(@"""$($_.LightYellow)$($_.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightYellow")
|
||||
.AddItemScriptBlock(@"""$($_.BrightYellow)$($_.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightYellow")
|
||||
.EndEntry()
|
||||
.EndList());
|
||||
}
|
||||
|
||||
private static IEnumerable<FormatViewDefinition> ViewsOf_System_Management_Automation_PSStyleBackgroundColor()
|
||||
{
|
||||
yield return new FormatViewDefinition("System.Management.Automation.PSStyle+ForegroundColor",
|
||||
yield return new FormatViewDefinition("System.Management.Automation.PSStyle+BackgroundColor",
|
||||
ListControl.Create()
|
||||
.StartEntry()
|
||||
.AddItemScriptBlock(@"""$($_.Black)$($_.Black.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Black")
|
||||
.AddItemScriptBlock(@"""$($_.BrightBlack)$($_.BrightBlack.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlack")
|
||||
.AddItemScriptBlock(@"""$($_.White)$($_.White.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "White")
|
||||
.AddItemScriptBlock(@"""$($_.DarkGray)$($_.DarkGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "DarkGray")
|
||||
.AddItemScriptBlock(@"""$($_.LightGray)$($_.LightGray.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGray")
|
||||
.AddItemScriptBlock(@"""$($_.BrightWhite)$($_.BrightWhite.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightWhite")
|
||||
.AddItemScriptBlock(@"""$($_.Red)$($_.Red.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Red")
|
||||
.AddItemScriptBlock(@"""$($_.LightRed)$($_.LightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightRed")
|
||||
.AddItemScriptBlock(@"""$($_.BrightRed)$($_.BrightRed.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightRed")
|
||||
.AddItemScriptBlock(@"""$($_.Magenta)$($_.Magenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Magenta")
|
||||
.AddItemScriptBlock(@"""$($_.LightMagenta)$($_.LightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.BrightMagenta)$($_.BrightMagenta.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightMagenta")
|
||||
.AddItemScriptBlock(@"""$($_.Blue)$($_.Blue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Blue")
|
||||
.AddItemScriptBlock(@"""$($_.LightBlue)$($_.LightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.BrightBlue)$($_.BrightBlue.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightBlue")
|
||||
.AddItemScriptBlock(@"""$($_.Cyan)$($_.Cyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Cyan")
|
||||
.AddItemScriptBlock(@"""$($_.LightCyan)$($_.LightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.BrightCyan)$($_.BrightCyan.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightCyan")
|
||||
.AddItemScriptBlock(@"""$($_.Green)$($_.Green.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Green")
|
||||
.AddItemScriptBlock(@"""$($_.LightGreen)$($_.LightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.BrightGreen)$($_.BrightGreen.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightGreen")
|
||||
.AddItemScriptBlock(@"""$($_.Yellow)$($_.Yellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "Yellow")
|
||||
.AddItemScriptBlock(@"""$($_.LightYellow)$($_.LightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "LightYellow")
|
||||
.AddItemScriptBlock(@"""$($_.BrightYellow)$($_.BrightYellow.Replace(""""`e"""",'`e'))$($PSStyle.Reset)""", label: "BrightYellow")
|
||||
.EndEntry()
|
||||
.EndList());
|
||||
}
|
||||
|
@ -552,7 +552,8 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
}
|
||||
else
|
||||
{
|
||||
_lo.WriteLine(rte.text);
|
||||
// Write out raw text without any changes to it.
|
||||
_lo.WriteRawText(rte.text);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -195,6 +195,13 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
/// </param>
|
||||
internal abstract void WriteLine(string s);
|
||||
|
||||
/// <summary>
|
||||
/// Write a line of string as raw text to the output device, with no change to the string.
|
||||
/// For example, keeping VT escape sequences intact in it.
|
||||
/// </summary>
|
||||
/// <param name="s">The raw text to be written to the device.</param>
|
||||
internal virtual void WriteRawText(string s) => WriteLine(s);
|
||||
|
||||
internal WriteStreamType WriteStream
|
||||
{
|
||||
get;
|
||||
@ -376,7 +383,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
/// Implementation of the ILineOutput interface accepting an instance of a
|
||||
/// TextWriter abstract class.
|
||||
/// </summary>
|
||||
internal class TextWriterLineOutput : LineOutput
|
||||
internal sealed class TextWriterLineOutput : LineOutput
|
||||
{
|
||||
#region ILineOutput methods
|
||||
|
||||
@ -412,9 +419,17 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
/// <param name="s"></param>
|
||||
internal override void WriteLine(string s)
|
||||
{
|
||||
CheckStopProcessing();
|
||||
WriteRawText(PSHostUserInterface.GetOutputString(s, isHost: false));
|
||||
}
|
||||
|
||||
s = PSHostUserInterface.GetOutputString(s, isHost: false);
|
||||
/// <summary>
|
||||
/// Write a raw text by delegating to the writer underneath, with no change to the text.
|
||||
/// For example, keeping VT escape sequences intact in it.
|
||||
/// </summary>
|
||||
/// <param name="s">The raw text to be written to the device.</param>
|
||||
internal override void WriteRawText(string s)
|
||||
{
|
||||
CheckStopProcessing();
|
||||
|
||||
if (_suppressNewline)
|
||||
{
|
||||
@ -425,6 +440,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
|
||||
_writer.WriteLine(s);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
@ -53,19 +53,9 @@ namespace System.Management.Automation
|
||||
public string Black { get; } = "\x1b[30m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color blue.
|
||||
/// Gets the color red.
|
||||
/// </summary>
|
||||
public string Blue { get; } = "\x1b[34m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color cyan.
|
||||
/// </summary>
|
||||
public string Cyan { get; } = "\x1b[36m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color dark gray.
|
||||
/// </summary>
|
||||
public string DarkGray { get; } = "\x1b[90m";
|
||||
public string Red { get; } = "\x1b[31m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color green.
|
||||
@ -73,39 +63,14 @@ namespace System.Management.Automation
|
||||
public string Green { get; } = "\x1b[32m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light blue.
|
||||
/// Gets the color yellow.
|
||||
/// </summary>
|
||||
public string LightBlue { get; } = "\x1b[94m";
|
||||
public string Yellow { get; } = "\x1b[33m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light cyan.
|
||||
/// Gets the color blue.
|
||||
/// </summary>
|
||||
public string LightCyan { get; } = "\x1b[96m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light gray.
|
||||
/// </summary>
|
||||
public string LightGray { get; } = "\x1b[97m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light green.
|
||||
/// </summary>
|
||||
public string LightGreen { get; } = "\x1b[92m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light magenta.
|
||||
/// </summary>
|
||||
public string LightMagenta { get; } = "\x1b[95m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light red.
|
||||
/// </summary>
|
||||
public string LightRed { get; } = "\x1b[91m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light yellow.
|
||||
/// </summary>
|
||||
public string LightYellow { get; } = "\x1b[93m";
|
||||
public string Blue { get; } = "\x1b[34m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color magenta.
|
||||
@ -113,9 +78,9 @@ namespace System.Management.Automation
|
||||
public string Magenta { get; } = "\x1b[35m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color read.
|
||||
/// Gets the color cyan.
|
||||
/// </summary>
|
||||
public string Red { get; } = "\x1b[31m";
|
||||
public string Cyan { get; } = "\x1b[36m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color white.
|
||||
@ -123,9 +88,44 @@ namespace System.Management.Automation
|
||||
public string White { get; } = "\x1b[37m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color yellow.
|
||||
/// Gets the color bright black.
|
||||
/// </summary>
|
||||
public string Yellow { get; } = "\x1b[33m";
|
||||
public string BrightBlack { get; } = "\x1b[90m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright red.
|
||||
/// </summary>
|
||||
public string BrightRed { get; } = "\x1b[91m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright green.
|
||||
/// </summary>
|
||||
public string BrightGreen { get; } = "\x1b[92m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright yellow.
|
||||
/// </summary>
|
||||
public string BrightYellow { get; } = "\x1b[93m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright blue.
|
||||
/// </summary>
|
||||
public string BrightBlue { get; } = "\x1b[94m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright magenta.
|
||||
/// </summary>
|
||||
public string BrightMagenta { get; } = "\x1b[95m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright cyan.
|
||||
/// </summary>
|
||||
public string BrightCyan { get; } = "\x1b[96m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright white.
|
||||
/// </summary>
|
||||
public string BrightWhite { get; } = "\x1b[97m";
|
||||
|
||||
/// <summary>
|
||||
/// Set as RGB (Red, Green, Blue).
|
||||
@ -168,19 +168,9 @@ namespace System.Management.Automation
|
||||
public string Black { get; } = "\x1b[40m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color blue.
|
||||
/// Gets the color red.
|
||||
/// </summary>
|
||||
public string Blue { get; } = "\x1b[44m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color cyan.
|
||||
/// </summary>
|
||||
public string Cyan { get; } = "\x1b[46m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color dark gray.
|
||||
/// </summary>
|
||||
public string DarkGray { get; } = "\x1b[100m";
|
||||
public string Red { get; } = "\x1b[41m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color green.
|
||||
@ -188,39 +178,14 @@ namespace System.Management.Automation
|
||||
public string Green { get; } = "\x1b[42m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light blue.
|
||||
/// Gets the color yellow.
|
||||
/// </summary>
|
||||
public string LightBlue { get; } = "\x1b[104m";
|
||||
public string Yellow { get; } = "\x1b[43m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light cyan.
|
||||
/// Gets the color blue.
|
||||
/// </summary>
|
||||
public string LightCyan { get; } = "\x1b[106m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light gray.
|
||||
/// </summary>
|
||||
public string LightGray { get; } = "\x1b[107m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light green.
|
||||
/// </summary>
|
||||
public string LightGreen { get; } = "\x1b[102m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light magenta.
|
||||
/// </summary>
|
||||
public string LightMagenta { get; } = "\x1b[105m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light red.
|
||||
/// </summary>
|
||||
public string LightRed { get; } = "\x1b[101m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color light yellow.
|
||||
/// </summary>
|
||||
public string LightYellow { get; } = "\x1b[103m";
|
||||
public string Blue { get; } = "\x1b[44m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color magenta.
|
||||
@ -228,9 +193,9 @@ namespace System.Management.Automation
|
||||
public string Magenta { get; } = "\x1b[45m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color read.
|
||||
/// Gets the color cyan.
|
||||
/// </summary>
|
||||
public string Red { get; } = "\x1b[41m";
|
||||
public string Cyan { get; } = "\x1b[46m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color white.
|
||||
@ -238,9 +203,44 @@ namespace System.Management.Automation
|
||||
public string White { get; } = "\x1b[47m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color yellow.
|
||||
/// Gets the color bright black.
|
||||
/// </summary>
|
||||
public string Yellow { get; } = "\x1b[43m";
|
||||
public string BrightBlack { get; } = "\x1b[100m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright red.
|
||||
/// </summary>
|
||||
public string BrightRed { get; } = "\x1b[101m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright green.
|
||||
/// </summary>
|
||||
public string BrightGreen { get; } = "\x1b[102m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright yellow.
|
||||
/// </summary>
|
||||
public string BrightYellow { get; } = "\x1b[103m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright blue.
|
||||
/// </summary>
|
||||
public string BrightBlue { get; } = "\x1b[104m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright magenta.
|
||||
/// </summary>
|
||||
public string BrightMagenta { get; } = "\x1b[105m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright cyan.
|
||||
/// </summary>
|
||||
public string BrightCyan { get; } = "\x1b[106m";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color bright white.
|
||||
/// </summary>
|
||||
public string BrightWhite { get; } = "\x1b[107m";
|
||||
|
||||
/// <summary>
|
||||
/// The color set as RGB (Red, Green, Blue).
|
||||
|
@ -101,8 +101,14 @@ namespace System.Management.Automation.Internal
|
||||
}
|
||||
}
|
||||
|
||||
// graphics/color mode ESC[1;2;...m
|
||||
private const string GraphicsRegex = @"(\x1b\[\d+(;\d+)*m)";
|
||||
|
||||
// CSI escape sequences
|
||||
private const string CsiRegex = @"(\x1b\[\?\d+[hl])";
|
||||
|
||||
// replace regex with .NET 6 API once available
|
||||
internal static readonly Regex AnsiRegex = new Regex(@"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])", RegexOptions.Compiled);
|
||||
internal static readonly Regex AnsiRegex = new Regex($"{GraphicsRegex}|{CsiRegex}", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ValueStringDecorated"/> struct.
|
||||
|
@ -12,23 +12,28 @@
|
||||
|
||||
<ItemGroup>
|
||||
<!-- the following package(s) are from https://github.com/JamesNK/Newtonsoft.Json -->
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<!-- Newtonsoft.Json brings in an old version of CSharp
|
||||
So, we are forcing a newer version.
|
||||
-->
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<!-- the Application Insights package -->
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.18.0" />
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
|
||||
<!-- the following package(s) are from https://github.com/dotnet/corefx -->
|
||||
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" />
|
||||
<PackageReference Include="System.Management" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="6.0.0-preview.5.21301.5" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Security.Permissions" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0-rc.1.21451.13" />
|
||||
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="6.0.0" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.1" />
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="6.0.1" />
|
||||
<!--PackageReference Include="System.IO.FileSystem.AccessControl" Version="6.0.0-preview.5.21301.5" /-->
|
||||
<PackageReference Include="System.Management" Version="6.0.2" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||
<PackageReference Include="System.Security.AccessControl" Version="6.0.0" />
|
||||
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.3" />
|
||||
<PackageReference Include="System.Security.Permissions" Version="6.0.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
|
||||
<!-- the following package(s) are from the powershell org -->
|
||||
<PackageReference Include="Microsoft.Management.Infrastructure" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.PowerShell.Native" Version="7.2.0-preview.2" />
|
||||
<PackageReference Include="Microsoft.PowerShell.Native" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -2977,13 +2977,20 @@ namespace System.Management.Automation.Runspaces
|
||||
HashSet<string> unresolvedCmdsToExpose)
|
||||
{
|
||||
RunspaceOpenModuleLoadException exceptionToReturn = null;
|
||||
List<PSModuleInfo> processedModules = new List<PSModuleInfo>();
|
||||
|
||||
foreach (object module in moduleList)
|
||||
{
|
||||
string moduleName = module as string;
|
||||
if (moduleName != null)
|
||||
{
|
||||
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleName, null, path, publicCommands);
|
||||
exceptionToReturn = ProcessOneModule(
|
||||
initializedRunspace: initializedRunspace,
|
||||
name: moduleName,
|
||||
moduleInfoToLoad: null,
|
||||
path: path,
|
||||
publicCommands: publicCommands,
|
||||
processedModules: processedModules);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2994,7 +3001,13 @@ namespace System.Management.Automation.Runspaces
|
||||
{
|
||||
// if only name is specified in the module spec, just try import the module
|
||||
// ie., don't take the performance overhead of calling GetModule.
|
||||
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleSpecification.Name, null, path, publicCommands);
|
||||
exceptionToReturn = ProcessOneModule(
|
||||
initializedRunspace: initializedRunspace,
|
||||
name: moduleSpecification.Name,
|
||||
moduleInfoToLoad: null,
|
||||
path: path,
|
||||
publicCommands: publicCommands,
|
||||
processedModules: processedModules);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3002,7 +3015,13 @@ namespace System.Management.Automation.Runspaces
|
||||
|
||||
if (moduleInfos != null && moduleInfos.Count > 0)
|
||||
{
|
||||
exceptionToReturn = ProcessOneModule(initializedRunspace, moduleSpecification.Name, moduleInfos[0], path, publicCommands);
|
||||
exceptionToReturn = ProcessOneModule(
|
||||
initializedRunspace: initializedRunspace,
|
||||
name: moduleSpecification.Name,
|
||||
moduleInfoToLoad: moduleInfos[0],
|
||||
path: path,
|
||||
publicCommands: publicCommands,
|
||||
processedModules: processedModules);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3051,7 +3070,11 @@ namespace System.Management.Automation.Runspaces
|
||||
string commandToMakeVisible = Utils.ParseCommandName(unresolvedCommand, out moduleName);
|
||||
bool found = false;
|
||||
|
||||
foreach (CommandInfo cmd in LookupCommands(commandToMakeVisible, moduleName, initializedRunspace.ExecutionContext))
|
||||
foreach (CommandInfo cmd in LookupCommands(
|
||||
commandPattern: commandToMakeVisible,
|
||||
moduleName: moduleName,
|
||||
context: initializedRunspace.ExecutionContext,
|
||||
processedModules: processedModules))
|
||||
{
|
||||
if (!found)
|
||||
{
|
||||
@ -3102,11 +3125,13 @@ namespace System.Management.Automation.Runspaces
|
||||
/// <param name="commandPattern"></param>
|
||||
/// <param name="moduleName"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="processedModules"></param>
|
||||
/// <returns></returns>
|
||||
private static IEnumerable<CommandInfo> LookupCommands(
|
||||
string commandPattern,
|
||||
string moduleName,
|
||||
ExecutionContext context)
|
||||
ExecutionContext context,
|
||||
List<PSModuleInfo> processedModules)
|
||||
{
|
||||
bool isWildCardPattern = WildcardPattern.ContainsWildcardCharacters(commandPattern);
|
||||
var searchOptions = isWildCardPattern ?
|
||||
@ -3120,7 +3145,11 @@ namespace System.Management.Automation.Runspaces
|
||||
CommandOrigin cmdOrigin = CommandOrigin.Runspace;
|
||||
while (true)
|
||||
{
|
||||
foreach (CommandInfo commandInfo in context.SessionState.InvokeCommand.GetCommands(commandPattern, CommandTypes.All, searchOptions, cmdOrigin))
|
||||
foreach (CommandInfo commandInfo in context.SessionState.InvokeCommand.GetCommands(
|
||||
name: commandPattern,
|
||||
commandTypes: CommandTypes.All,
|
||||
options: searchOptions,
|
||||
commandOrigin: cmdOrigin))
|
||||
{
|
||||
// If module name is provided then use it to restrict returned results.
|
||||
if (haveModuleName && !moduleName.Equals(commandInfo.ModuleName, StringComparison.OrdinalIgnoreCase))
|
||||
@ -3150,13 +3179,43 @@ namespace System.Management.Automation.Runspaces
|
||||
// Next try internal search.
|
||||
cmdOrigin = CommandOrigin.Internal;
|
||||
}
|
||||
|
||||
// If the command is associated with a module, try finding the command in the imported module list.
|
||||
// The SessionState function table holds only one command name, and if two or more modules contain
|
||||
// a command with the same name, only one of them will appear in the function table search above.
|
||||
if (!found && haveModuleName)
|
||||
{
|
||||
var pattern = new WildcardPattern(commandPattern);
|
||||
|
||||
foreach (PSModuleInfo moduleInfo in processedModules)
|
||||
{
|
||||
if (moduleInfo.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
foreach (var cmd in moduleInfo.ExportedCommands.Values)
|
||||
{
|
||||
if (pattern.IsMatch(cmd.Name))
|
||||
{
|
||||
yield return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If <paramref name="moduleInfoToLoad"/> is null, import module using <paramref name="name"/>. Otherwise,
|
||||
/// import module using <paramref name="moduleInfoToLoad"/>
|
||||
/// </summary>
|
||||
private RunspaceOpenModuleLoadException ProcessOneModule(Runspace initializedRunspace, string name, PSModuleInfo moduleInfoToLoad, string path, HashSet<CommandInfo> publicCommands)
|
||||
private RunspaceOpenModuleLoadException ProcessOneModule(
|
||||
Runspace initializedRunspace,
|
||||
string name,
|
||||
PSModuleInfo moduleInfoToLoad,
|
||||
string path,
|
||||
HashSet<CommandInfo> publicCommands,
|
||||
List<PSModuleInfo> processedModules)
|
||||
{
|
||||
using (PowerShell pse = PowerShell.Create())
|
||||
{
|
||||
@ -3193,6 +3252,11 @@ namespace System.Management.Automation.Runspaces
|
||||
c = new CmdletInfo("Out-Default", typeof(OutDefaultCommand), null, null, initializedRunspace.ExecutionContext);
|
||||
pse.AddCommand(new Command(c));
|
||||
}
|
||||
else
|
||||
{
|
||||
// For runspace init module processing, pass back the PSModuleInfo to the output pipeline.
|
||||
cmd.Parameters.Add("PassThru");
|
||||
}
|
||||
|
||||
pse.Runspace = initializedRunspace;
|
||||
// Module import should be run in FullLanguage mode since it is running in
|
||||
@ -3201,7 +3265,10 @@ namespace System.Management.Automation.Runspaces
|
||||
pse.Runspace.ExecutionContext.LanguageMode = PSLanguageMode.FullLanguage;
|
||||
try
|
||||
{
|
||||
pse.Invoke();
|
||||
// For runspace init module processing, collect the imported PSModuleInfo returned in the output pipeline.
|
||||
// In other cases, this collection will be empty.
|
||||
Collection<PSModuleInfo> moduleInfos = pse.Invoke<PSModuleInfo>();
|
||||
processedModules.AddRange(moduleInfos);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -4489,7 +4556,7 @@ end {
|
||||
SpecialVariables.PSStyle,
|
||||
PSStyle.Instance,
|
||||
RunspaceInit.PSStyleDescription,
|
||||
ScopedItemOptions.None),
|
||||
ScopedItemOptions.Constant),
|
||||
|
||||
// Variable which controls the encoding for piping data to a NativeCommand
|
||||
new SessionStateVariableEntry(
|
||||
|
@ -381,17 +381,6 @@ namespace Microsoft.PowerShell.Commands
|
||||
private Exception _taskCollectionException;
|
||||
private string _currentLocationPath;
|
||||
|
||||
// List of Foreach-Object command names and aliases.
|
||||
// TODO: Look into using SessionState.Internal.GetAliasTable() to find all user created aliases.
|
||||
// But update Alias command logic to maintain reverse table that lists all aliases mapping
|
||||
// to a single command definition, for performance.
|
||||
private static readonly string[] forEachNames = new string[]
|
||||
{
|
||||
"ForEach-Object",
|
||||
"foreach",
|
||||
"%"
|
||||
};
|
||||
|
||||
private void InitParallelParameterSet()
|
||||
{
|
||||
// The following common parameters are not (yet) supported in this parameter set.
|
||||
@ -422,8 +411,7 @@ namespace Microsoft.PowerShell.Commands
|
||||
_usingValuesMap = ScriptBlockToPowerShellConverter.GetUsingValuesForEachParallel(
|
||||
scriptBlock: Parallel,
|
||||
isTrustedInput: allowUsingExpression,
|
||||
context: this.Context,
|
||||
foreachNames: forEachNames);
|
||||
context: this.Context);
|
||||
|
||||
// Validate using values map, which is a map of '$using:' variables referenced in the script.
|
||||
// Script block variables are not allowed since their behavior is undefined outside the runspace
|
||||
|
@ -7210,6 +7210,9 @@ namespace Microsoft.PowerShell.Commands
|
||||
CommandOrigin.Internal,
|
||||
targetSessionState.ExecutionContext);
|
||||
|
||||
// Note that the module 'func' and the function table 'functionInfo' instances are now linked
|
||||
// together (see 'CopiedCommand' in CommandInfo class), so setting visibility on one also
|
||||
// sets it on the other.
|
||||
SetCommandVisibility(isImportModulePrivate, functionInfo);
|
||||
functionInfo.Module = sourceModule;
|
||||
|
||||
|
@ -958,7 +958,8 @@ namespace System.Management.Automation
|
||||
#if UNIX
|
||||
return Platform.SelectProductNameForDirectory(Platform.XDG_Type.USER_MODULES);
|
||||
#else
|
||||
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Utils.ModuleDirectory);
|
||||
string myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||
return string.IsNullOrEmpty(myDocumentsPath) ? null : Path.Combine(myDocumentsPath, Utils.ModuleDirectory);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1180,7 +1181,18 @@ namespace System.Management.Automation
|
||||
currentProcessModulePath = hkcuUserModulePath; // = EVT.User
|
||||
}
|
||||
|
||||
currentProcessModulePath += Path.PathSeparator;
|
||||
if (string.IsNullOrEmpty(currentProcessModulePath))
|
||||
{
|
||||
if (currentProcessModulePath is null)
|
||||
{
|
||||
currentProcessModulePath = string.Empty;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentProcessModulePath += Path.PathSeparator;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(hklmMachineModulePath)) // EVT.Machine does Not exist
|
||||
{
|
||||
currentProcessModulePath += CombineSystemModulePaths(); // += (SharedModulePath + $PSHome\Modules)
|
||||
@ -1201,11 +1213,23 @@ namespace System.Management.Automation
|
||||
// personalModulePath
|
||||
// sharedModulePath
|
||||
// systemModulePath
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, personalModulePathToUse, 0);
|
||||
int insertIndex = PathContainsSubstring(currentProcessModulePath, personalModulePathToUse) + personalModulePathToUse.Length + 1;
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, sharedModulePath, insertIndex);
|
||||
insertIndex = PathContainsSubstring(currentProcessModulePath, sharedModulePath) + sharedModulePath.Length + 1;
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, systemModulePathToUse, insertIndex);
|
||||
int insertIndex = 0;
|
||||
if (!string.IsNullOrEmpty(personalModulePathToUse))
|
||||
{
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, personalModulePathToUse, insertIndex);
|
||||
insertIndex = PathContainsSubstring(currentProcessModulePath, personalModulePathToUse) + personalModulePathToUse.Length + 1;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(sharedModulePath))
|
||||
{
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, sharedModulePath, insertIndex);
|
||||
insertIndex = PathContainsSubstring(currentProcessModulePath, sharedModulePath) + sharedModulePath.Length + 1;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(systemModulePathToUse))
|
||||
{
|
||||
currentProcessModulePath = AddToPath(currentProcessModulePath, systemModulePathToUse, insertIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return currentProcessModulePath;
|
||||
|
@ -326,7 +326,7 @@ namespace System.Management.Automation
|
||||
catch (Exception)
|
||||
{
|
||||
// Do cleanup in case of exception
|
||||
CleanUp();
|
||||
CleanUp(killBackgroundProcess: true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ namespace System.Management.Automation
|
||||
catch (Exception)
|
||||
{
|
||||
// Do cleanup in case of exception
|
||||
CleanUp();
|
||||
CleanUp(killBackgroundProcess: true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -782,7 +782,7 @@ namespace System.Management.Automation
|
||||
finally
|
||||
{
|
||||
// Do some cleanup
|
||||
CleanUp();
|
||||
CleanUp(killBackgroundProcess: false);
|
||||
}
|
||||
|
||||
// An exception was thrown while attempting to run the program
|
||||
@ -979,15 +979,30 @@ namespace System.Management.Automation
|
||||
#if UNIX
|
||||
return false;
|
||||
#else
|
||||
if (!Platform.IsWindowsDesktop) { return false; }
|
||||
|
||||
// SHGetFileInfo() does not understand reparse points and returns 0 ("non exe or error")
|
||||
// so we are trying to get a real path before.
|
||||
// It is a workaround for Microsoft Store applications.
|
||||
string realPath = Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods.WinInternalGetTarget(fileName);
|
||||
if (realPath is not null)
|
||||
if (!Platform.IsWindowsDesktop)
|
||||
{
|
||||
fileName = realPath;
|
||||
return false;
|
||||
}
|
||||
|
||||
// The function 'SHGetFileInfo()' does not understand reparse points and returns 0 ("non exe or error")
|
||||
// for a symbolic link file, so we try to get the immediate link target in that case.
|
||||
// Why not get the final target (use 'returnFinalTarget: true')? Because:
|
||||
// 1. When starting a process on Windows, if the 'FileName' is a symbolic link, the immediate link target will automatically be used,
|
||||
// but the OS does not do recursive resolution when the immediate link target is also a symbolic link.
|
||||
// 2. Keep the same behavior as before adopting the 'LinkTarget' and 'ResolveLinkTarget' APIs in .NET 6.
|
||||
try
|
||||
{
|
||||
string linkTarget = File.ResolveLinkTarget(fileName, returnFinalTarget: false)?.FullName;
|
||||
if (linkTarget is not null)
|
||||
{
|
||||
fileName = linkTarget;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// An exception may be thrown from 'File.ResolveLinkTarget' when it fails to resolve a link path,
|
||||
// for example, when the underlying file system doesn't support reparse points.
|
||||
// Just use the original file name in this case.
|
||||
}
|
||||
|
||||
SHFILEINFO shinfo = new SHFILEINFO();
|
||||
@ -1045,7 +1060,8 @@ namespace System.Management.Automation
|
||||
/// <summary>
|
||||
/// Aggressively clean everything up...
|
||||
/// </summary>
|
||||
private void CleanUp()
|
||||
/// <param name="killBackgroundProcess">If set, also terminate background process.</param>
|
||||
private void CleanUp(bool killBackgroundProcess)
|
||||
{
|
||||
// We need to call 'NotifyEndApplication' as appropriate during cleanup
|
||||
if (_hasNotifiedBeginApplication)
|
||||
@ -1055,23 +1071,23 @@ namespace System.Management.Automation
|
||||
|
||||
try
|
||||
{
|
||||
if (_nativeProcess != null)
|
||||
{
|
||||
// on Unix, we need to kill the process to ensure it terminates as Dispose() merely
|
||||
// closes the redirected streams and the processs does not exit on macOS. However,
|
||||
// on Windows, a winexe like notepad should continue running so we don't want to kill it.
|
||||
// on Unix, we need to kill the process (if not running in background) to ensure it terminates,
|
||||
// as Dispose() merely closes the redirected streams and the process does not exit.
|
||||
// However, on Windows, a winexe like notepad should continue running so we don't want to kill it.
|
||||
#if UNIX
|
||||
if (killBackgroundProcess || !_isRunningInBackground)
|
||||
{
|
||||
try
|
||||
{
|
||||
_nativeProcess.Kill();
|
||||
_nativeProcess?.Kill();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore all exception since it is cleanup.
|
||||
// Ignore all exceptions since it is cleanup.
|
||||
}
|
||||
#endif
|
||||
_nativeProcess.Dispose();
|
||||
}
|
||||
#endif
|
||||
_nativeProcess.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
@ -1245,11 +1245,18 @@ namespace System.Management.Automation
|
||||
name != null,
|
||||
"The caller should verify the name");
|
||||
|
||||
var functionInfos = GetFunctions();
|
||||
FunctionInfo existingValue;
|
||||
Dictionary<string, FunctionInfo> functionInfos = GetFunctions();
|
||||
FunctionInfo result;
|
||||
if (!functionInfos.TryGetValue(name, out existingValue))
|
||||
|
||||
// Functions are equal only if they have the same name and if they come from the same module (if any).
|
||||
// If the function is not associated with a module then the info 'ModuleName' property is set to empty string.
|
||||
// If the new function has the same name of an existing function, but different module names, then the
|
||||
// existing table function is replaced with the new function.
|
||||
if (!functionInfos.TryGetValue(name, out FunctionInfo existingValue) ||
|
||||
(originalFunction != null &&
|
||||
!existingValue.ModuleName.Equals(originalFunction.ModuleName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
// Add new function info to function table and return.
|
||||
result = functionFactory(name, function, originalFunction, options, context, helpFile);
|
||||
functionInfos[name] = result;
|
||||
|
||||
@ -1257,81 +1264,78 @@ namespace System.Management.Automation
|
||||
{
|
||||
GetAllScopeFunctions()[name] = result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Update the existing function.
|
||||
|
||||
// Make sure the function isn't constant or readonly.
|
||||
SessionState.ThrowIfNotVisible(origin, existingValue);
|
||||
|
||||
if (IsFunctionOptionSet(existingValue, ScopedItemOptions.Constant) ||
|
||||
(!force && IsFunctionOptionSet(existingValue, ScopedItemOptions.ReadOnly)))
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionNotWritable",
|
||||
SessionStateStrings.FunctionNotWritable);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Ensure we are not trying to set the function to constant as this can only be
|
||||
// done at creation time.
|
||||
if ((options & ScopedItemOptions.Constant) != 0)
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionCannotBeMadeConstant",
|
||||
SessionStateStrings.FunctionCannotBeMadeConstant);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Ensure we are not trying to remove the AllScope option.
|
||||
if ((options & ScopedItemOptions.AllScope) == 0 &&
|
||||
IsFunctionOptionSet(existingValue, ScopedItemOptions.AllScope))
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionAllScopeOptionCannotBeRemoved",
|
||||
SessionStateStrings.FunctionAllScopeOptionCannotBeRemoved);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
FunctionInfo existingFunction = existingValue;
|
||||
|
||||
// If the function type changes (i.e.: function to workflow or back)
|
||||
// then we need to replace what was there.
|
||||
FunctionInfo newValue = functionFactory(name, function, originalFunction, options, context, helpFile);
|
||||
|
||||
bool changesFunctionType = existingFunction.GetType() != newValue.GetType();
|
||||
|
||||
// Since the options are set after the script block, we have to
|
||||
// forcefully apply the script block if the options will be
|
||||
// set to not being ReadOnly.
|
||||
if (changesFunctionType ||
|
||||
((existingFunction.Options & ScopedItemOptions.ReadOnly) != 0 && force))
|
||||
{
|
||||
result = newValue;
|
||||
functionInfos[name] = newValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make sure the function isn't constant or readonly
|
||||
|
||||
SessionState.ThrowIfNotVisible(origin, existingValue);
|
||||
|
||||
if (IsFunctionOptionSet(existingValue, ScopedItemOptions.Constant) ||
|
||||
(!force && IsFunctionOptionSet(existingValue, ScopedItemOptions.ReadOnly)))
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionNotWritable",
|
||||
SessionStateStrings.FunctionNotWritable);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Ensure we are not trying to set the function to constant as this can only be
|
||||
// done at creation time.
|
||||
|
||||
if ((options & ScopedItemOptions.Constant) != 0)
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionCannotBeMadeConstant",
|
||||
SessionStateStrings.FunctionCannotBeMadeConstant);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
// Ensure we are not trying to remove the AllScope option
|
||||
|
||||
if ((options & ScopedItemOptions.AllScope) == 0 &&
|
||||
IsFunctionOptionSet(existingValue, ScopedItemOptions.AllScope))
|
||||
{
|
||||
SessionStateUnauthorizedAccessException e =
|
||||
new SessionStateUnauthorizedAccessException(
|
||||
name,
|
||||
SessionStateCategory.Function,
|
||||
"FunctionAllScopeOptionCannotBeRemoved",
|
||||
SessionStateStrings.FunctionAllScopeOptionCannotBeRemoved);
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
||||
FunctionInfo existingFunction = existingValue;
|
||||
FunctionInfo newValue = null;
|
||||
|
||||
// If the function type changes (i.e.: function to workflow or back)
|
||||
// then we need to blast what was there
|
||||
newValue = functionFactory(name, function, originalFunction, options, context, helpFile);
|
||||
|
||||
bool changesFunctionType = existingFunction.GetType() != newValue.GetType();
|
||||
|
||||
// Since the options are set after the script block, we have to
|
||||
// forcefully apply the script block if the options will be
|
||||
// set to not being ReadOnly
|
||||
if (changesFunctionType ||
|
||||
((existingFunction.Options & ScopedItemOptions.ReadOnly) != 0 && force))
|
||||
{
|
||||
result = newValue;
|
||||
functionInfos[name] = newValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool applyForce = force || (options & ScopedItemOptions.ReadOnly) == 0;
|
||||
|
||||
existingFunction.Update(newValue, applyForce, options, helpFile);
|
||||
result = existingFunction;
|
||||
}
|
||||
bool applyForce = force || (options & ScopedItemOptions.ReadOnly) == 0;
|
||||
existingFunction.Update(newValue, applyForce, options, helpFile);
|
||||
result = existingFunction;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -680,10 +680,7 @@ namespace System.Management.Automation.Runspaces
|
||||
AddMember(
|
||||
errors,
|
||||
typeName,
|
||||
new PSCodeProperty(
|
||||
@"Target",
|
||||
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods), @"GetTarget"),
|
||||
setterCodeReference: null),
|
||||
new PSAliasProperty(@"Target", @"LinkTarget", conversionType: null),
|
||||
typeMembers,
|
||||
isOverride: false);
|
||||
|
||||
@ -808,10 +805,7 @@ namespace System.Management.Automation.Runspaces
|
||||
AddMember(
|
||||
errors,
|
||||
typeName,
|
||||
new PSCodeProperty(
|
||||
@"Target",
|
||||
GetMethodInfo(typeof(Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods), @"GetTarget"),
|
||||
setterCodeReference: null),
|
||||
new PSAliasProperty(@"Target", @"LinkTarget", conversionType: null),
|
||||
typeMembers,
|
||||
isOverride: false);
|
||||
|
||||
|
@ -1574,7 +1574,6 @@ namespace System.Management.Automation.Internal
|
||||
internal static bool BypassAppLockerPolicyCaching;
|
||||
internal static bool BypassOnlineHelpRetrieval;
|
||||
internal static bool ForcePromptForChoiceDefaultOption;
|
||||
internal static bool BypassOutputRedirectionCheck;
|
||||
internal static bool NoPromptForPassword;
|
||||
internal static bool ForceFormatListFixedLabelWidth;
|
||||
|
||||
@ -1593,6 +1592,8 @@ namespace System.Management.Automation.Internal
|
||||
internal static bool SetConsoleWidthToZero;
|
||||
internal static bool SetConsoleHeightToZero;
|
||||
|
||||
internal static bool SetDate;
|
||||
|
||||
// A location to test PSEdition compatibility functionality for Windows PowerShell modules with
|
||||
// since we can't manipulate the System32 directory in a test
|
||||
internal static string TestWindowsPowerShellPSHomeLocation;
|
||||
|
@ -304,18 +304,12 @@ namespace System.Management.Automation.Host
|
||||
/// <param name="formatStyle">
|
||||
/// The format style to get the escape sequence for.
|
||||
/// </param>
|
||||
/// <param name="isOutputRedirected">
|
||||
/// True if the output is redirected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The ANSI escape sequence for the given format style.
|
||||
/// </returns>
|
||||
public static string GetFormatStyleString(FormatStyle formatStyle, bool isOutputRedirected)
|
||||
public static string GetFormatStyleString(FormatStyle formatStyle)
|
||||
{
|
||||
// redirected console gets plaintext output to preserve existing behavior
|
||||
if (!InternalTestHooks.BypassOutputRedirectionCheck &&
|
||||
(PSStyle.Instance.OutputRendering == OutputRendering.PlainText ||
|
||||
isOutputRedirected))
|
||||
if (PSStyle.Instance.OutputRendering == OutputRendering.PlainText)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
@ -353,30 +347,22 @@ namespace System.Management.Automation.Host
|
||||
/// <param name="supportsVirtualTerminal">
|
||||
/// True if the host supports virtual terminal.
|
||||
/// </param>
|
||||
/// <param name="isOutputRedirected">
|
||||
/// True if the output is redirected.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The formatted text.
|
||||
/// </returns>
|
||||
public static string GetOutputString(string text, bool supportsVirtualTerminal, bool isOutputRedirected)
|
||||
public static string GetOutputString(string text, bool supportsVirtualTerminal)
|
||||
{
|
||||
return GetOutputString(text, isHost: true, supportsVirtualTerminal: supportsVirtualTerminal, isOutputRedirected: isOutputRedirected);
|
||||
return GetOutputString(text, isHost: true, supportsVirtualTerminal: supportsVirtualTerminal);
|
||||
}
|
||||
|
||||
internal static string GetOutputString(string text, bool isHost, bool? supportsVirtualTerminal = null, bool isOutputRedirected = false)
|
||||
internal static string GetOutputString(string text, bool isHost, bool? supportsVirtualTerminal = null)
|
||||
{
|
||||
var sd = new ValueStringDecorated(text);
|
||||
|
||||
if (sd.IsDecorated)
|
||||
{
|
||||
var outputRendering = OutputRendering.Ansi;
|
||||
if (InternalTestHooks.BypassOutputRedirectionCheck)
|
||||
{
|
||||
isOutputRedirected = false;
|
||||
}
|
||||
|
||||
if (isOutputRedirected || ShouldOutputPlainText(isHost, supportsVirtualTerminal))
|
||||
if (ShouldOutputPlainText(isHost, supportsVirtualTerminal))
|
||||
{
|
||||
outputRendering = OutputRendering.PlainText;
|
||||
}
|
||||
|
@ -1011,10 +1011,6 @@ namespace System.Management.Automation.Internal
|
||||
CommandState.Started,
|
||||
commandProcessor.Command.MyInvocation);
|
||||
|
||||
// Telemetry here
|
||||
// the type of command should be sent along
|
||||
// commandProcessor.CommandInfo.CommandType
|
||||
ApplicationInsightsTelemetry.SendTelemetryMetric(TelemetryType.ApplicationType, commandProcessor.Command.CommandInfo.CommandType.ToString());
|
||||
#if LEGACYTELEMETRY
|
||||
Microsoft.PowerShell.Telemetry.Internal.TelemetryAPI.TraceExecutedCommand(commandProcessor.Command.CommandInfo, commandProcessor.Command.CommandOrigin);
|
||||
#endif
|
||||
|
@ -125,234 +125,6 @@ namespace System.Management.Automation
|
||||
// to client to let client know if the negotiation succeeded.
|
||||
internal const string IsNegotiationSucceeded = "IsNegotiationSucceeded";
|
||||
|
||||
#region "PSv2 Tab Expansion Function"
|
||||
|
||||
internal const string PSv2TabExpansionFunction = "TabExpansion";
|
||||
|
||||
/// <summary>
|
||||
/// This is the PSv2 function for tab expansion. It's only for legacy purpose - used in
|
||||
/// an interactive remote session from a win7 machine to a win8 machine (or later).
|
||||
/// </summary>
|
||||
internal const string PSv2TabExpansionFunctionText = @"
|
||||
param($line, $lastWord)
|
||||
& {
|
||||
function Write-Members ($sep='.')
|
||||
{
|
||||
Invoke-Expression ('$_val=' + $_expression)
|
||||
|
||||
$_method = [Management.Automation.PSMemberTypes] `
|
||||
'Method,CodeMethod,ScriptMethod,ParameterizedProperty'
|
||||
if ($sep -eq '.')
|
||||
{
|
||||
$params = @{view = 'extended','adapted','base'}
|
||||
}
|
||||
else
|
||||
{
|
||||
$params = @{static=$true}
|
||||
}
|
||||
|
||||
foreach ($_m in ,$_val | Get-Member @params $_pat |
|
||||
Sort-Object membertype,name)
|
||||
{
|
||||
if ($_m.MemberType -band $_method)
|
||||
{
|
||||
# Return a method...
|
||||
$_base + $_expression + $sep + $_m.name + '('
|
||||
}
|
||||
else {
|
||||
# Return a property...
|
||||
$_base + $_expression + $sep + $_m.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If a command name contains any of these chars, it needs to be quoted
|
||||
$_charsRequiringQuotes = ('`&@''#{}()$,;|<> ' + ""`t"").ToCharArray()
|
||||
|
||||
# If a variable name contains any of these characters it needs to be in braces
|
||||
$_varsRequiringQuotes = ('-`&@''#{}()$,;|<> .\/' + ""`t"").ToCharArray()
|
||||
|
||||
switch -regex ($lastWord)
|
||||
{
|
||||
# Handle property and method expansion rooted at variables...
|
||||
# e.g. $a.b.<tab>
|
||||
'(^.*)(\$(\w|:|\.)+)\.([*\w]*)$' {
|
||||
$_base = $matches[1]
|
||||
$_expression = $matches[2]
|
||||
$_pat = $matches[4] + '*'
|
||||
Write-Members
|
||||
break;
|
||||
}
|
||||
|
||||
# Handle simple property and method expansion on static members...
|
||||
# e.g. [datetime]::n<tab>
|
||||
'(^.*)(\[(\w|\.|\+)+\])(\:\:|\.){0,1}([*\w]*)$' {
|
||||
$_base = $matches[1]
|
||||
$_expression = $matches[2]
|
||||
$_pat = $matches[5] + '*'
|
||||
Write-Members $(if (! $matches[4]) {'::'} else {$matches[4]})
|
||||
break;
|
||||
}
|
||||
|
||||
# Handle complex property and method expansion on static members
|
||||
# where there are intermediate properties...
|
||||
# e.g. [datetime]::now.d<tab>
|
||||
'(^.*)(\[(\w|\.|\+)+\](\:\:|\.)(\w+\.)+)([*\w]*)$' {
|
||||
$_base = $matches[1] # everything before the expression
|
||||
$_expression = $matches[2].TrimEnd('.') # expression less trailing '.'
|
||||
$_pat = $matches[6] + '*' # the member to look for...
|
||||
Write-Members
|
||||
break;
|
||||
}
|
||||
|
||||
# Handle variable name expansion...
|
||||
'(^.*\$)([*\w:]+)$' {
|
||||
$_prefix = $matches[1]
|
||||
$_varName = $matches[2]
|
||||
$_colonPos = $_varname.IndexOf(':')
|
||||
if ($_colonPos -eq -1)
|
||||
{
|
||||
$_varName = 'variable:' + $_varName
|
||||
$_provider = ''
|
||||
}
|
||||
else
|
||||
{
|
||||
$_provider = $_varname.Substring(0, $_colonPos+1)
|
||||
}
|
||||
|
||||
foreach ($_v in Get-ChildItem ($_varName + '*') | sort Name)
|
||||
{
|
||||
$_nameFound = $_v.name
|
||||
$(if ($_nameFound.IndexOfAny($_varsRequiringQuotes) -eq -1) {'{0}{1}{2}'}
|
||||
else {'{0}{{{1}{2}}}'}) -f $_prefix, $_provider, $_nameFound
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
# Do completion on parameters...
|
||||
'^-([*\w0-9]*)' {
|
||||
$_pat = $matches[1] + '*'
|
||||
|
||||
# extract the command name from the string
|
||||
# first split the string into statements and pipeline elements
|
||||
# This doesn't handle strings however.
|
||||
$_command = [regex]::Split($line, '[|;=]')[-1]
|
||||
|
||||
# Extract the trailing unclosed block e.g. ls | foreach { cp
|
||||
if ($_command -match '\{([^\{\}]*)$')
|
||||
{
|
||||
$_command = $matches[1]
|
||||
}
|
||||
|
||||
# Extract the longest unclosed parenthetical expression...
|
||||
if ($_command -match '\(([^()]*)$')
|
||||
{
|
||||
$_command = $matches[1]
|
||||
}
|
||||
|
||||
# take the first space separated token of the remaining string
|
||||
# as the command to look up. Trim any leading or trailing spaces
|
||||
# so you don't get leading empty elements.
|
||||
$_command = $_command.TrimEnd('-')
|
||||
$_command,$_arguments = $_command.Trim().Split()
|
||||
|
||||
# now get the info object for it, -ArgumentList will force aliases to be resolved
|
||||
# it also retrieves dynamic parameters
|
||||
try
|
||||
{
|
||||
$_command = @(Get-Command -type 'Alias,Cmdlet,Function,Filter,ExternalScript' `
|
||||
-Name $_command -ArgumentList $_arguments)[0]
|
||||
}
|
||||
catch
|
||||
{
|
||||
# see if the command is an alias. If so, resolve it to the real command
|
||||
if(Test-Path alias:\$_command)
|
||||
{
|
||||
$_command = @(Get-Command -Type Alias $_command)[0].Definition
|
||||
}
|
||||
|
||||
# If we were unsuccessful retrieving the command, try again without the parameters
|
||||
$_command = @(Get-Command -type 'Cmdlet,Function,Filter,ExternalScript' `
|
||||
-Name $_command)[0]
|
||||
}
|
||||
|
||||
# remove errors generated by the command not being found, and break
|
||||
if(-not $_command) { $error.RemoveAt(0); break; }
|
||||
|
||||
# expand the parameter sets and emit the matching elements
|
||||
# need to use psbase.Keys in case 'keys' is one of the parameters
|
||||
# to the cmdlet
|
||||
foreach ($_n in $_command.Parameters.psbase.Keys)
|
||||
{
|
||||
if ($_n -like $_pat) { '-' + $_n }
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
# Tab complete against history either #<pattern> or #<id>
|
||||
'^#(\w*)' {
|
||||
$_pattern = $matches[1]
|
||||
if ($_pattern -match '^[0-9]+$')
|
||||
{
|
||||
Get-History -ea SilentlyContinue -Id $_pattern | ForEach-Object { $_.CommandLine }
|
||||
}
|
||||
else
|
||||
{
|
||||
$_pattern = '*' + $_pattern + '*'
|
||||
Get-History -Count 32767 | Sort-Object -Descending Id| ForEach-Object { $_.CommandLine } | where { $_ -like $_pattern }
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
# try to find a matching command...
|
||||
default {
|
||||
# parse the script...
|
||||
$_tokens = [System.Management.Automation.PSParser]::Tokenize($line,
|
||||
[ref] $null)
|
||||
|
||||
if ($_tokens)
|
||||
{
|
||||
$_lastToken = $_tokens[$_tokens.count - 1]
|
||||
if ($_lastToken.Type -eq 'Command')
|
||||
{
|
||||
$_cmd = $_lastToken.Content
|
||||
|
||||
# don't look for paths...
|
||||
if ($_cmd.IndexOfAny('/\:') -eq -1)
|
||||
{
|
||||
# handle parsing errors - the last token string should be the last
|
||||
# string in the line...
|
||||
if ($lastword.Length -ge $_cmd.Length -and
|
||||
$lastword.substring($lastword.length-$_cmd.length) -eq $_cmd)
|
||||
{
|
||||
$_pat = $_cmd + '*'
|
||||
$_base = $lastword.substring(0, $lastword.length-$_cmd.length)
|
||||
|
||||
# get files in current directory first, then look for commands...
|
||||
$( try {Resolve-Path -ea SilentlyContinue -Relative $_pat } catch {} ;
|
||||
try { $ExecutionContext.InvokeCommand.GetCommandName($_pat, $true, $false) |
|
||||
Sort-Object -Unique } catch {} ) |
|
||||
# If the command contains non-word characters (space, ) ] ; ) etc.)
|
||||
# then it needs to be quoted and prefixed with &
|
||||
ForEach-Object {
|
||||
if ($_.IndexOfAny($_charsRequiringQuotes) -eq -1) { $_ }
|
||||
elseif ($_.IndexOf('''') -ge 0) {'& ''{0}''' -f $_.Replace('''','''''') }
|
||||
else { '& ''{0}''' -f $_ }} |
|
||||
ForEach-Object {'{0}{1}' -f $_base,$_ }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
#endregion "PSv2 Tab Expansion Function"
|
||||
|
||||
#region Host Related Strings
|
||||
|
||||
internal const string CallId = "ci";
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user