Commit graph

1686 commits

Author SHA1 Message Date
Aditya Patwardhan 82091d6a45
Merge release-v6.2.0-preview.2 to master
Merge Release-v6.2.0-preview.2
2018-11-15 17:59:42 -08:00
Steve Lee c5dd3bd2c9 Support 'Get-PSHostProcessInfo' and 'Enter-PSHostProcess' on Unix platforms (#8232)
There a some differences in support of named pipes for Windows and non-Windows.  Named pipes on Unix have a 104 character path limit.  On macOS, the `$env:TMPDIR` (on my system) is already 49 characters; corefx adds 12 more.  Since AppDomainName isn't really used, changed it from `DefaultAppDomain` to `None` to shorten the name.  Need to keep it since Windows PowerShell expects it.  Changed `starttime` part of pipe name to 8 hex characters which is to provide uniqueness to the pipe name.
2018-11-15 12:50:04 -08:00
Staffan Gustafsson 877b9a9fbf Add cmdlet 'Join-String' for creating text from pipeline input (#7660)
The cmdlet syntax is as follows:
```
Join-String [[-Property] <pspropertyexpression>] [[-Separator] <string>] [-OutputPrefix <string>] [-OutputSuffix <string>] [-UseCulture] [-InputObject <psobject>] [<CommonParameters>]

Join-String [[-Property] <pspropertyexpression>] [[-Separator] <string>] [-OutputPrefix <string>] [-OutputSuffix <string>] [-SingleQuote] [-UseCulture] [-InputObject <psobject>] [<CommonParameters>]

Join-String [[-Property] <pspropertyexpression>] [[-Separator] <string>] [-OutputPrefix <string>] [-OutputSuffix <string>] [-DoubleQuote] [-UseCulture] [-InputObject <psobject>] [<CommonParameters>]

Join-String [[-Property] <pspropertyexpression>] [[-Separator] <string>] [-OutputPrefix <string>] [-OutputSuffix <string>] [-FormatString <string>] [-UseCulture] [-InputObject <psobject>] [<CommonParameters>]
```
2018-11-14 13:52:44 -08:00
Steve Lee 43e0394d51 Remove extra newlines from formatting which resulted in necessary double newlines (#8247) 2018-11-14 08:28:05 +05:00
Aditya Patwardhan 20497d19c2 Merged PR 5822: Update version for dependencies
Update version for dependencies
2018-11-14 01:56:28 +00:00
Travis Plunk 79f21b41de
Consolidation of all Windows PowerShell work ported to PSCore6 (#8257)
Consolidation of all Windows PowerShell work ported to PSCore6

* Added ps1 file import restriction.  Refactored InvokeLanguageModeTestingSupportCmdlet to HelpersSecurity module
* JEA loop back fix.  Debugger running commands in CL mode.
* Support for new AMSI codes.  Changed to use AMSI buffer API.  Unhandled exception fix.
* Fixes for module bugs while running in ConstrainedLanguage mode
* Untrusted input tracking work
* Configuration keyword bug fix, PSRP protocol version check for reconstruct reconnect, Sharing InitialSessionState in runspace pool.
* Restricted remote session in UMCI, Applocker detection collision, Help command exposing functions, Null reference exception fix.
* Added mitigation for debugger function exposure
2018-11-13 16:16:29 -08:00
Robert Holt aa76c6846d Fix incorrect name check when autoloading required modules (#8218) 2018-11-13 14:56:07 -08:00
Travis Plunk 18a181fc30
Fix CVE-2018-8415 (#8253)
If there is a null character in a scriptblock, translate it to a null replacement character before logging with scriptblock logging.
2018-11-13 11:30:48 -08:00
Travis Plunk db60f0614a Revert "Ignoring backspace for empty lines on stdin/stdout mode (#8196)" (#8239)
This reverts commit b525b1f0bd.
2018-11-12 13:14:04 -08:00
bugale b525b1f0bd Ignoring backspace for empty lines on stdin/stdout mode (#8196) 2018-11-10 18:55:28 +05:00
Paul Higinbotham d4bf5c87bc Fix tests running in Azure DevOps (#8220) 2018-11-09 15:11:02 -08:00
kwkam caad7ed471 Fix Rename-Item -Path with wildcard char (#7398) 2018-11-09 11:08:26 -08:00
Kevin Marquette 75fa6af9c0 Add test coverage for additional Get-Module parameters (#8137) 2018-11-07 17:16:53 +05:00
Paal Braathen 2e89efa1bc When using Start-Transcript and file exists, empty file rather than deleting (#8131) 2018-11-07 08:34:42 +05:00
Travis Plunk 5e47c73e27
Fix static secret in code (#8186) 2018-11-05 18:29:04 -08:00
Aditya Patwardhan b5ab2ddd40 Load assembly from module base path before trying to load from GAC (#8073)
[Breaking Change]
When a binary module has the module assembly in GAC, we load the assembly from GAC before trying to load it from module base path.

This change attempts to load it from module base path before looking up in GAC.
2018-11-05 10:41:53 -08:00
Andrew Schwartzmeyer 54874180ce Remove build and doc references to Git submodules (#8177)
As of #7892, the PowerShell repository no longer uses Git submodules.
This is fantastic from a workflow standpoint, and so all the notes about
how to deal with submodules (and all the build steps explicitly
initializing and updating submodules) can be safely removed.
2018-11-05 10:39:29 -08:00
Robert Holt 5d06fba366 Refactor module version/GUID comparison logic (#7125) 2018-11-01 13:41:51 -07:00
Travis Plunk c6910a12fa Fix conflict with Get-AdlStoreChildItem from az module in tab completion tests (#8167) 2018-11-01 12:03:03 -07:00
PRASOON KARUNAN V f59353d5d9 Error message enhancement for clear-content cmdlet when targeting a directory (#8134) 2018-11-01 08:56:45 +05:00
Steve Lee 1eec123f48 Create $PROFILE if it does not exist for -WorkingDirectory processing test (#8152) 2018-10-30 22:06:19 -07:00
Paul Higinbotham 20f3a6a337 Experimental feature: Implicit remoting batching perf improvement (#8038) 2018-10-30 09:55:39 -07:00
Steve Lee 1aa5bb3576 Honor -OutputFormat if specified in noninteractive, redirected, encoded command used with pwsh (#8115)
[Breaking Change]

There is specific code that sets the `OutputFormat` to xml if pwsh is run non-interactive, with redirected output, and the command was encoded.  However, it ignored whether OutputFormat was specified.  Fix is to track whether `-OutputFormat` was used and respect that value rather than defaulting to xml.

Fix https://github.com/PowerShell/PowerShell/issues/5912
2018-10-29 17:51:21 -07:00
Steve Lee b1e2745b53 move processing of -WorkingDirectory before processing of profiles (#8079) 2018-10-29 13:56:13 -07:00
dependabot[bot] b3f315eb15 Bump xunit from 2.4.0 to 2.4.1 (#8140) 2018-10-29 13:28:02 -07:00
dependabot[bot] cbfe2c8fe8 Bump xunit.runner.visualstudio from 2.4.0 to 2.4.1 (#8139) 2018-10-29 13:27:25 -07:00
Steve Lee b27380dc51 Enable case-insensitive tab completion for files and folders on case-sensitive filesystem (#8128) 2018-10-28 09:48:49 +05:00
Steve Lee 9141b11c5e Enable Set-Location -LiteralPath to work with folders named "-" and "+" (#8089) 2018-10-24 09:37:59 +05:00
Steve Lee 082c3b0bae Enable Add-Content to share read access to other tools while writing content (#8091) 2018-10-23 16:27:53 -07:00
Patrick Meinecke 57bf508fec Fix static method invocation type inference (#8018)
Fixes type inference for static method invocations (e.g. [powershell]::Create()).
2018-10-23 16:58:31 +05:00
Steve Lee 3ceb1c17ef Fix logic to not rely on build number to determine whether to output formatdata (#8063) 2018-10-19 12:45:03 -07:00
Steve Lee 4e5e3900f6 Allow dynamic parameter to be returned even if path matches nothing (#7957) 2018-10-18 11:44:08 -07:00
Ilya f1e2136a2b
Add -Name, -NoUserOverrides and -ListAvailable parameters to Get-Culture cmdlet (#7702)
Add new parameters in Get-Culture cmdlet:
-Name - to allow retrieving a specific culture
-NoUserOverrides - ignore user changes for current culture
-ListAvalable - to allow retrieving all cultures supported on the platform
2018-10-18 17:34:34 +05:00
Ilya 745e305ac5
Add new Offset and Count parameters to Format-Hex and refactor the cmdlet (#7877)
- Add new Offset and Count parameters.
- Modify ByteCollection class to support offsets up to UInt64.MaxValue size.
- Hide/obsolete Raw parameter because the behavior is by default.
- Optimize conversion to bytes to reduce allocations for large input data.
2018-10-18 10:03:59 +05:00
Joel Sallow 33f2f0faaf Add Type Inference for $_ / $PSItem in catch{ } blocks (#8020) 2018-10-18 09:42:16 +05:00
Aditya Patwardhan d99afc46df Merged PR 5382: Add missing dependency
Add missing dependency
2018-10-16 21:28:42 +00:00
Aditya Patwardhan 1e31e707c8 Merged PR 5363: Version and doc changes
Version and doc changes
2018-10-15 20:24:00 +00:00
Steve Lee 8bca5a6017 Allow root node of format.ps1xml to have attributes that are ignored (#7987) 2018-10-12 11:31:21 -07:00
Steve Lee b62e152f4d Improve error message on non-Windows when importing clixml with securestring (#7997) 2018-10-12 10:56:35 -07:00
Dongbo Wang 9b94f18ccf
Fix BeginInvoke/EndInvoke to return results when Stop or BeginStop/EndStop was called previously (#7917)
The root cause is that `OutputBuffer` is not cleaned up (set to `null`) in `Stop` and `BeginStop/EndStop` when the powershell instance owns the `OutputBuffer` object. Since the pipeline has been intentionally stopped by the caller, the `OutputBuffer` should be set to `null` as well when it's owned by the PowerShell instance, just like how it's cleaned up in `EndInvoke`.
2018-10-12 10:46:57 -07:00
Steve Lee 5b4e9a9881 Change API to match cmdlet which is more reliable in AzDevOpsPipelines Windows (#8003) 2018-10-11 15:52:12 -07:00
Steve Lee 5bc76bd912 Remove package tests as we have DependABot enabled to keep packages updated (#8001) 2018-10-11 14:03:41 -07:00
Ilya 17fd2e9392 Revert "Only display properties with values for MeasureInfo (#7104)" (#7754)
This reverts commit 87ccd0aa40 until
security review of the public api has been completed.
2018-10-11 12:48:46 -07:00
Patrick Meinecke 680ad9c835 Fix Property and ScriptBlock expressions in EntrySelectedBy tags within custom controls (#7913)
Send the current object when evaluating `EntrySelectedBy` in a custom control definition
2018-10-11 21:09:39 +05:00
Joel Sallow e660e9623a Add support for Byte Literals (#7901)
- Adds y suffix that is used to specify a numeric literal as the sbyte data type. 
- Can be combined with the existing u suffix as uy to specify the byte data type.
2018-10-11 17:40:58 +05:00
Christoph Bergmeister [MVP] fe731eda14 Use dotnet test since the dotnet xunit test runner has been deprecated (#7980) 2018-10-09 20:55:41 -07:00
Sergey Vasin 3b3160841e Standardize Pester syntax in 'ReplaceOperator.Tests.ps1' (#7963) 2018-10-08 23:15:53 -07:00
dependabot[bot] 6b6d5e3fd1 Bump Xunit.SkippableFact from 1.3.6 to 1.3.12 (#7972)
Bumps [Xunit.SkippableFact](https://github.com/AArnott/Xunit.SkippableFact) from 1.3.6 to 1.3.12.
- [Release notes](https://github.com/AArnott/Xunit.SkippableFact/releases)
- [Commits](https://github.com/AArnott/Xunit.SkippableFact/compare/v1.3.6...v1.3.12)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-10-08 11:07:54 -07:00
Topping 20b2e3df37 No longer skips a column without name if double quote delimiter is used in Import-Csv (#7899) 2018-10-05 09:15:56 +05:00
Ilya 371d25a74b Update to .NET Core 2.1.5 with SDK 2.1.403 (#7936) 2018-10-03 13:31:56 -07:00
Ilya 450d884668
Add test for $error[0] tab completion (#7924) 2018-10-03 12:34:21 +05:00
Ilya d862d4075f
Add EscapeHandling parameter in ConvertTo-Json cmdlet (#7775)
Add EscapeHandling parameter in ConvertTo-Json cmdlet to allow escape the HTML (<, >, &, ', ") and control characters (e.g. newline).
2018-10-02 10:54:33 +05:00
Ilya 0727f96d97
Replace hang term (#7902) 2018-10-02 08:11:38 +05:00
Robert Holt 649d342a07 Replace test certificates with self-signed certificate generating command (#7875) 2018-10-01 14:40:48 -07:00
Benjamin P. McKenna 39252b4938 Add '%F' case to Get-Date -UFormat (#7630) 2018-10-01 08:39:14 +05:00
James Truher [MSFT] 98cf44cdec Test changes needed for running in a container (#7869) 2018-09-28 13:49:31 -07:00
Steve Lee cc44781b5b Ensure NestedModules property gets populated by Test-ModuleManifest (#7859) 2018-09-28 13:28:08 -07:00
Joel Sallow 8f4b66af29 Add C#-style type accelerators and suffixes for ushort, uint, ulong, and short literals (#7813)
[breaking change]
Add the following type accelerators: [short], [ushort], [uint], [ulong].
Add the following numeric literal suffixes:
 - 'u' suffix (uint/ulong)
 - 's' suffix (short)
 - 'ul' suffix (ulong)
 - 'us' suffix (ushort)
2018-09-28 13:27:32 -07:00
PRASOON KARUNAN V e6702fe780 Get/Add-Content throws improved error when targeting a container (#7823) 2018-09-28 20:36:13 +05:00
Robert Holt bd5f7719bc Add version checking tests for Import-Module (#7499) 2018-09-27 17:08:54 -07:00
Andrew bc5fe72096 Updating test gallery URL in PackageManagement tests (#7879) 2018-09-27 14:23:10 -07:00
Steve Lee 769ba7b95c Update PowerShellGet to 2.0.0 (#7831) 2018-09-24 14:58:13 -07:00
Travis Plunk 8a0abf459c
update markdown tests (#7838)
update markdown tests

  - explicitly use gulp 4.0 beta because 3.9 depends on a vulnerable package
2018-09-24 10:14:43 -07:00
Dongbo Wang 0f0c46dfe5 Update to .NET Core 2.1.4 with SDK 2.1.402 (#7834) 2018-09-21 13:25:03 -07:00
Dongbo Wang b6d12a35ed [Feature] Fix .NET adapter to be able to get members from System.IntPtr (#7808)
The type System.IntPtr has an explicit cast operator defined that takes a pointer type System.void* parameter. Now we handle that type properly in GetPSMethodProjectedType.
2018-09-20 08:15:42 +05:00
Staffan Gustafsson eb286332cf Create inferred types for Select-Object, Group-Object, PSObject and Hashtable (#7231)
Fixes #7230.

Adding the concept of a PSSyntheticTypeName, derived from PSTypeName,
that extends it with a list of synthetic members.

This allows us to express the inferred type of
```
[pscustomobject] @{
   A = 1
   B = "2"
}
```
as a "PSObject#A:B" and with information about the types of A and B.

This is also used to annotate the output of
```
Select-Object -Property
Select-Object -ExcludeProperty
Select-Object -ExpandProperty
```
Finally, it adds information about the types of the
`Group` and `Value` properties of the output of `Group-Object`
2018-09-19 15:43:22 -07:00
Ilya cc5f36c67a
Allow numeric Ids and name of registered code pages in '-Encoding' parameters (#7636)
Enhance the encoding transformation attribute:
- to allow numeric Ids of registered code pages (like -Encoding 1251)
- to allow string names of registered code pages (like -Encoding "windows-1251")
2018-09-19 18:53:03 +05:00
Christoph Bergmeister [MVP] 4bc22d92df Add support for 'cd +' (#7206)
'cd +' adds the ability to revert 'cd -' by having another bounded stack with the same limit for 'redo' actions.
Behaviour is similar to back/forward navigation in explorer.exe
When the location is set to a path and the redo stack is non-empty then the redo stack gets flushed.
When cd + happens, then the redo stack is pushed to as well for a more intuitive way of navigating backwards and forwards.
All the work is done of course on the Set-location cmdlet, which is aliased to cd on all platforms.
2018-09-19 12:50:30 +05:00
Robert Holt 3c67fa3411 Add tests for Import-Module -Force (#7491) 2018-09-19 09:32:35 +05:00
Andrew e725a030d7 Updating ModulePath.Tests for fxdependent package (#7772) 2018-09-17 13:22:00 -07:00
Dongbo Wang 285e471034
Fix .NET adapter to not throw when fails to create a PSMethod due to ByRef-like type (#7788) 2018-09-17 12:45:55 -07:00
Dongbo Wang 720e842c86
Support calling method with ByRef-like type parameters (#7721)
Support calling methods with ByRef-like type parameters in PowerShell, as long as the argument specified for the parameter can be implicitly/explicitly converted to the ByRef-like type.

We cannot create an instance of a ByRef-like type in PowerShell, but there are types that can be implicitly or explicitly converted to ByRef-like types, such as `T[] -> Span<T>`, `T[] -> ReadOnlySpan<T>`, `String -> ReadOnlySpan<T>`. `ArraySegment<T> -> Span<T>`, `ArraySegment<T> -> ReadOnlySpan<T>`. With changes in this PR, we can call methods with ByRef-like parameter types by providing the arguments of the types that can be cast to the target ByRef-like type.

**What is enabled?**
1. Invoking methods that have ByRef-like parameters, but the return type is not ByRef-like.
2. Invoking constructors with ByRef-like parameters via `[target-type]::new` syntax, but the `target-type` is not ByRef-like.
3. Accessing indexers that have ByRef-like parameters, but the return type is not ByRef-like.
2018-09-11 16:57:35 -07:00
ThreeFive-O 32cdbe688e Fix pipeline test where SmtpServer key was set wrong in pipeline object (#7745)
Fix SmtpServer key (was $SmtpServer) in hashtable object.
Removed double quotes for all keys in hashtable object.
2018-09-11 09:29:10 +05:00
Aditya Patwardhan 2e3069900b Update version for powershell release 6.1.0 (#7751) 2018-09-10 13:08:42 -07:00
Dan Travison 4683934793 Update PowerShell to handle the case where the Windows PowerShell module path is already in the environment's PSModulePath (#7727)
This change updates ModuleIntrinsics.GetModulePath to handle the case where the Windows PowerShell module path is already in the environment's PSModulePath or when launched from a different version of PowerShell.

Previously, GetModulePath would append $PSHOME\Modules to the PSModulePath after removing the path for the launching version without considering the Windows PowerShell module path. The result, was the Windows PowerShell modules were found first and loaded incompatible modules; such as the built-in modules.

The change detects the Windows PowerShell module path and inserts $PSHOME\Modules path before it. The new test simulates launching from a different version of pwsh that has already added the Windows PowerShell module path.

Fixes #7679
2018-09-10 10:58:38 -07:00
Travis Plunk 2141c2a8e3
Add daily build non-windows platforms (#7683)
Add daily build non-windows platforms
  - Also, make the [Feature] tag work in VSTS for non-windows
  - Also, add a way to force feature tests to run
  - Also, fix an issue where `-workingdirectory` didn't work when running async
2018-09-06 12:27:49 -07:00
Sergey Vasin ccd2e536cb Fix module specification hashtable in ModuleSpecification.Tests.ps1 (#7663) 2018-09-04 10:06:35 -07:00
Travis Plunk e2a45f0992
Add tests to report when package references are out of date (#7661)
Add tests to report when package references are out of date
  - Also, update the packaging script to generate updated `files.wxs`
2018-08-31 12:50:51 -07:00
Ilya c34d3ef332 Update to latest package references, runtime framework, and SDK (#7646)
* Move to .Net Core SDK 2.1.401 and runtime 2.1.3

* Update package references
2018-08-30 18:39:44 -07:00
Christoph Bergmeister [MVP] b3c961f882 Update docs about .NET Core version 2.0 to be about version 2.x (#7467) 2018-08-30 16:51:52 -07:00
James Truher [MSFT] bc1aac78d3 Change logic for downloading zip files based on job id (#7653) 2018-08-30 11:23:19 -07:00
Patrick Meinecke 5c2faaf02e Enable indexing operations on objects that implement ITuple (#7633)
This change enables index operations on objects that implement `ITuple` and other interfaces that have `DefaultMemberAttribute` declared, including slicing and negative indexing.
2018-08-30 10:54:26 -07:00
Yuriy Kushnir 165f2c9a42 Use non-virtual call to invoke 'family or assembly' methods on base class from PowerShell class (#7622) (#7624) 2018-08-28 22:24:06 -07:00
zhenggu 358e8abefe Fix Set-Service -Status Stopped to stop services with dependencies (#5525) 2018-08-28 11:03:12 -07:00
Staffan Gustafsson 87ccd0aa40 Only display properties with values for MeasureInfo (#7104)
* Adding support for built-in List formats to include ItemSelectionCondition
* Adding ItemSelectionCondition to GenericMeasureInfo
* Adding tests for MeasureInfo format-list
* Adding positive tests
2018-08-28 08:18:56 +05:00
Staffan Gustafsson 1bfe96d3c4 Add Duration property to HistoryInfo (#5208)
* Remove regions in HistoryInfo class
* Auto properties refactoring in HistoryInfo
* Adding Duration property to HistoryInfo
* Rename ExecutionTime => Duration
2018-08-28 08:03:07 +05:00
Aditya Patwardhan aec954e3ed Fix null reference when markdown content is empty (#7463) 2018-08-27 11:58:19 +05:00
Dongbo Wang 86469bda33
Handle operations with ByRef-like types gracefully in PowerShell (#7533)
ByRef-like types are supposed to be used on stack only, so we need to fail gracefully when accessing properties, calling methods, or creating objects related to ByRef-like types.
2018-08-26 12:50:58 -07:00
Travis Plunk bf0787f9a0
Make -settingfile work for scriptblock logging on windows (#7631)
Make `-settingfile` work for scriptblock logging on windows
  - Move EarlyParse to the first thing in the ManagedEntrance so that we don't cache the settings before we parse the settings file.
  - Added a test case to prevent regression
    - I'm working on more test cases.  Therefore, I used the TestCases parameter.
  - Changed the macOS tests back to CI as I think they are stable enough now.
2018-08-26 11:03:28 -07:00
Travis Plunk 6c454c6ea8
Update test which assumes all previews have the name preview in the version. (#7625) 2018-08-23 17:19:45 -07:00
Ilya 75c70a2a7c Update pester syntax in Set-Location test (#7615) 2018-08-23 15:15:03 -07:00
Dan Travison 23832e5e95 Update 'SSHConnectionInfo Class Tests' $skipTest expression to use collection semantics instead of relying on $null (which causes a type cast exception). (#7610) 2018-08-23 15:10:39 -07:00
Travis Plunk d6817a42e4
Add Linux ScriptBlock logging test (#7599) 2018-08-22 16:34:03 -07:00
Bruce Payette 4943bbfd9e Add LocationChangedAction handler and tests to support the Windows Compat module (#7552)
Add LocationChangedAction handler and tests to support the Windows Compat module.
2018-08-22 12:08:03 -07:00
Travis Plunk 97d2e10c22
Merge release v6.1.0 rc.1 into master (#7608) 2018-08-22 12:06:00 -07:00
Travis Plunk 849f6fb147
Add test for scriptblock logging for macOS (#7586) 2018-08-21 13:20:54 -07:00
Aditya Patwardhan cbbc8192c4 Merged PR 4656: Add back the powershell-core source for hosting tests 2018-08-21 17:24:06 +00:00
Travis Plunk 40532d9a2e
Add VSTS CI for Windows (#7536)
- Add VSTS CI for Windows
    - Disable `Access-denied test for Get-Item C:\windows\appcompat\Programs\Install -ErrorAction Stop`, because the path does not always exist
        - https://github.com/PowerShell/PowerShell/issues/7553
    - Disable `Should give .sys file if the fullpath is specified with hidden and force parameter`, because pagefile.sys doesn't always exist and other files don't meet test's requirement.
        - https://github.com/PowerShell/PowerShell/issues/7554
    - Disable some `Test-Connection` tests for same reasons they failed on VSTS Linux
        - https://github.com/PowerShell/PowerShell/issues/7555
    - Disable `Test-FileCatalog should pass when catalog is in the same folder as files being tested`, because the CmdLet does not work in that scenario
         - Also, give details needed to investigate when the test fails
         - https://github.com/PowerShell/PowerShell/issues/7556
    - Update `appveyor.psm1` to work with VSTS
    - Update `HelpersRemoting.psm1` `New-RemoteSession` to work for CimSession (discovered an issue during the investigation)
    - Update `Test wildcard with drive relative directory path` to work when there are multiple drives
         - Disable on non-windows machines since the test is assuming drive letters
    - Update `New-CimSession` Tests to requireAdmin
         - Also, make sure session name is a string
    - Add functions to save and restore psoptions
    - update `.gitatttributes` so files clone like they do on appveyor
2018-08-17 22:06:51 -07:00
Aditya Patwardhan 96b2c83c59 Update reference to use packages from NuGet.org (#7525)
Update psrp and libpsl reference to Microsoft.PowerShell.Native
Keep the reference to powershell.myget.org in nuget.config for PSDesiredStateConfiguration and PowerShellHelpFiles
Update hosting tests
Update hosting.tests.csproj in preparation on next release with version 6.1.0-rc.1
Update Microsoft.Management.Infrastructure to version 1.0.0
2018-08-16 15:56:15 -07:00
Travis Plunk a746fd29ec
Revert "Throw error on entering non-existing type in Get-FormatData (#7434)" (#7546)
Revert "Throw error on entering non-existing type in Get-FormatData (#7434)
This reverts commit b754cd80d5.

Per this comment https://github.com/PowerShell/PowerShell/pull/7434#issuecomment-413696259
2018-08-16 15:46:12 -07:00
Travis Plunk 0a1a47e8b0
Make sure we do not upload artifacts during a pull request (#7535) 2018-08-16 13:11:24 -07:00
Paul Higinbotham a21366710c Updated thread job to version 1.1.2 (#7522)
Added fix to remove unneeded validation attribute for Arguments parameter, and made tests work with strict mode.
2018-08-14 17:09:48 -07:00
Travis Plunk 965552873c
Add Linux VSTS CI (#7527)
Update Start-PSPester and Start-PSxUnit to upload test results when running in VSTS
Disable tests which require non-root using when running as root
remove verifications in Test-Connection tests which verify buggy behavior
Skip tests which don't behave correctly in VSTS (due to running in a container?)
- Test-Connection - #7528
- Set-Date - #7529
2018-08-14 16:23:50 -07:00
Steve Lee 769b02ab98 Save modules to un-versioned folder to enable servicing (#7518)
Remove code from build.psm1 that save the modules to a versioned folder. For servicing reasons after release it is preferred and easier to not have the versioned folder so that we can directly replace modules that need to be serviced (MSI specifically makes it difficult to service a module if the folder path changes).
2018-08-14 10:15:05 -07:00
Travis Plunk b3d0913d74
Add CI definition for VSTS for macOS (#7490)
Add CI definition for VSTS for macOS
  - Add VSTS YAML for mac
  - Add a function to upload log files during a test on VSTS
2018-08-10 15:13:31 -07:00
Staffan Gustafsson 3aaa1816d1 Adding 'LanguagePrimitives.TryCompare' to provide faster comparisons (#7438) 2018-08-10 10:20:27 -07:00
Syed Faraaz Ahmad b754cd80d5 Throw error on entering non-existing type in Get-FormatData (#7434)
Write non-terminating error when `Get-FormatData` doesn't found a type definition for the provided type,
2018-08-10 09:34:02 +05:00
Staffan Gustafsson 618d9f31a0 Add '-SkipIndex' parameter to 'Select-Object' (#7483) 2018-08-09 11:59:54 -07:00
Dongbo Wang ca64bfb3e3
Update the 'HelpUri' for 'Get-ExperimentalFeature' (#7466) 2018-08-08 12:38:07 -07:00
Travis Plunk d29349bb4d
Default to DefaultConsoleWidth when DotNet says WindowWidth is 0 (#7465)
Default to DefaultConsoleWidth when DotNet says WindowWidth is 0

This resolves an issue in an environment like VSTS when pwsh is spawned and DotNet is not able to determine the Console Width.
* Port changes from #6883 by @kalgiz
2018-08-07 15:27:42 -07:00
Travis Plunk 1523c218a6
Make sure that SettingFile arg is parsed before we load the settings (#7449)
Make sure that SettingFile arg is parsed before we load the settings

- Add ability to parse some setting before console host is created
- Trigger the Parse before the console host is created
- disable snapin loading from loading setting before this point
- re-enable mac logging tests.

Also, fix the following Travis-ci issues:

- make sure the Linux and macOS caches are separate to reduce the size
- update the macOS image to the closest image as used by the official build system (equivalent to VSTS hosted mac builds)
2018-08-07 15:01:31 -07:00
Bruce Payette 0c11582e6c Make Native globbing on UNIX return an absolute path when it is given an absolute path (#7106)
Fix #7089. Native globbing on UNIX was turning absolute paths into relative paths when it shouldn't. The code suppresses generating a relative path for paths starting with '~'. It also need to do the same for paths starting with '/'.
2018-08-07 14:38:22 -07:00
Steve Lee 36dc96af0e Fix error message for Add-Type when -AssemblyName with wildcard is not found (#7444) 2018-08-06 11:12:39 -07:00
kwkam fbfbb4f005 [Feature] Fix Move-Item -Path with wildcard char (#7397)
Unescape non-literal, non-glob path in ProccessRecord and
set the context.SuppressWildcardExpansion in RenameItem.
This solve the issue where Rename-Item complains -Path does not exist
when both -Path and CWD contains special characters.
2018-08-05 17:31:06 +05:00
Robert Holt dbdcf6e5eb Fix to not duplicate the System32 module path when starting pwsh from pwsh (#7414) 2018-08-03 11:22:30 -07:00
Dongbo Wang 25c127c3bc
Update CI scripts to support running tests for experimental features (#7419) 2018-08-03 11:20:14 -07:00
Steve Lee f8b3abaac7 Add support for passing files and markdown directly to Show-Markdown (#7354)
* add support for -Path/-LiteralPath and piping strings directly to Show-Markdown

* update tests to set vt100 support
2018-08-02 15:49:38 -07:00
Christoph Bergmeister [MVP] 5717a5dffc Add xunit project to PowerShell.sln and make it runable from within VisualStudio (#7254)
* add csproj ref to sln

* Remove Microsoft.NET.Test.Sdk NuGet reference. The xunit.runner.visualstudio package is now sufficient for running tests in VS in the latest version (15.7.5)

* use RTM versions of XUnit 2.4.0 that got published today

* Update XUnit in hosting project as well to newer release
2018-08-02 11:51:04 -07:00
Dongbo Wang 73b6d810bd
Make logging tests for macOS pending (#7433) 2018-08-01 16:49:39 -07:00
Sergey Vasin 740d059d51 Change parameters order in Get-Help and help in order to get first -Full and then -Functionality when using Get-Help -Fu<tab> and help -Fu<tab>. (#7370) 2018-07-31 11:13:18 +05:00
Sergey Vasin 58ac08c60a Use -HaveCount instead of -Be in Where-Object.Tests.ps1. (#7379) 2018-07-31 08:51:42 +05:00
Sergey Vasin da6d2647ac Use -BeExactly and -HaveCount instead of -Be in TabCompletion.Tests.ps1. (#7380) 2018-07-30 10:32:52 +05:00
Sergey Vasin 9e30419501 Use -BeExactly and -HaveCount instead of -Be in BugFix.Tests.ps1. (#7386) 2018-07-30 08:17:28 +05:00
Aditya Patwardhan 4e7c2ed663 Fix several issues in Markdown cmdlets (#7329)
- Formatting file should be used for `MarkdownOptionInfo` object instead of the types file for adding script property.
- Downlevel windows consoles which do not support VT100 escape sequences should be handled gracefully.
- Add helpuri fwlink for cmdlets.
- Make `-Path` a positional parameter for `ConvertFrom-Markdown`
- make `-InputObject` a positional parameter for `Set-MarkdownOption`
2018-07-27 17:26:35 -07:00
Steve Lee b767d5cacd Fix IsHardLink() to return false instead of throwing exception when unable to determine (#7355) 2018-07-26 10:08:38 -07:00
Paul Higinbotham 20f7577548 Fix ThreadJob tests so that they will run more reliably (#7360) 2018-07-26 10:02:05 -07:00
Dan Travison 936626b7e8 Update PowerShell to reference 'psrp.1.4.5-0' on Unix build (#7350) 2018-07-25 10:04:00 -07:00
Dongbo Wang 87d8fc969c
Fix sequence point update for switch/if/for/while/do-while/do-until statements (#7305)
- Make switch-statement report correct error position when it fails to evaluate the condition.
- Make for-statement report correct error position when it fails to evaluate the initializer.
- For the condition of `if/for/while/do-while/do-until` statements, the sequence point update is either duplicate in some cases (for `if/for/while`) which causes debugger to stop at the condition twice  before moving forward, or missing (for `do-while/do-until`) which causes debugger to skip the condition. They are fixed.
2018-07-25 09:56:32 -07:00
Adam Gauthier e34554c3ca Ignore Newtonsoft.Json metadata properties in ConvertFrom-Json (#7308)
Some values are not converted from json to PSCustomObject, because Newtonsoft.Json reads them and thinks they are metadata properties only useful for deserialization. This change makes Newtonsoft.Json "ignore" those properties so they are converted correctly from json to PSCustomObject.
2018-07-25 08:56:49 +05:00
Steve Lee f5a7d79175 Add support for parsing Link Header with variable whitespace (#7322)
Fix is to change the regex to allow for variable or no whitespace and associated tests to handle these two cases.
2018-07-24 10:56:00 +05:00
Steve Lee 0a2f9c8821 Update Enable-PSRemoting so configuration name for Preview releases (#7202)
The intent was to have the version of the PSSessionConfiguration name not include the `v` for the version string.  Also, Preview releases should standardize on `PowerShell.6-Preview` instead of clobbering `PowerShell.6` so that stable and preview can co-exist side-by-side.

Need to verify on Win10 IoT if `Install-PowerShellRemoting.ps1` is still needed anymore as it may be possible to run `pwsh -c enable-psremoting` from within Windows PowerShell Core removing the need for that script which duplicates `Enable-PSRemoting` capability.

Update: Not able to get the current master build working on Win10 IoT, getting `Invalid access to memory` error.  Will have to investigate this separately from this PR and keep `Install-PowerShellRemoting.ps1` for now.

Fix https://github.com/PowerShell/PowerShell/issues/7119
2018-07-16 19:35:48 -07:00
Robert Holt c94fc31f97 Enforce the 'CompatiblePSEditions' check for modules from the legacy 'System32' module path (#7183)
- Add `%WINDIR%\System32\WindowsPowerShell\v1.0\Modules` (Windows PowerShell $PSHOME) to the end of the default PSCore 6 module path (i.e. the module path as initially set at startup).
- Cause an error to be thrown by `Import-Module` when a module with `CompatiblePSEditions` not containing `"Core"` is being loaded from the 'System32' module path.
- Suppress output of modules listed by `Get-Module -ListAvailable` from Windows PowerShell $PSHOME when `CompatiblePSEditions` does not contain `"Core"`.
- Introduce the `-SkipCompatibilityCheck` switch parameter on both `Import-Module` and `Get-Module` to respectively allow importing incompatible modules and listing incompatible modules.
- Adds a  `PSEdition` column to the `PSModuleInfo` table view format.
- Ensures that completions are not given for incompatible modules on the System32 module path.
2018-07-16 16:58:40 -07:00
Dongbo Wang 6f3e9d0881
Added Markdown rendering cmdlets (#6926)
- `ConvertFrom-Markdown` is used for converting a markdown document or string to a MarkdownInfo object. It can optionally return an HTML or a VT100 encoded string in addition to an AST of the markdown document.
- `Show-Markdown` is used to either display the VT100 encoded string on the console or redirect the HTML string to the browser.
- `Set/Get-MarkdownOption` cmdlets are used to view or set markdown rendering options.
2018-07-13 13:56:17 -07:00
Aditya Patwardhan ab07b85f01
Merge pull request #7284 from daxian-dbw/removeVB
Remove the 'VisualBasic' support from Add-Type
2018-07-13 13:48:50 -07:00
Bruce Payette f4a50eda0d Fix prompt string to be platform agnostic and keep its trailing spaces (#7255) 2018-07-13 01:22:10 -07:00
Bruce Payette 716ed2acbd Fix a parsing error when 'break' and 'continue' are used in a switch statement in a finally block (#7273) 2018-07-13 01:19:47 -07:00
Dongbo Wang c34866d0fa [Feature] Remove 'VisualBasic' support from Add-Type 2018-07-12 23:50:09 -07:00
Travis Plunk b15709f444 update to latest package references, runtime framework, and SDK (#7272)
* update to latest package references

* update runtime framework

* update sdk

* automatically read NuGet package dependency info from csproj, where version info is fully qualified

* update file.wxs
2018-07-13 09:00:35 +05:00
Aditya Patwardhan e711c5dcc3 [Feature] Address code review comments 2018-07-12 17:17:50 -07:00
Aditya Patwardhan 731afbf14d [Feature] Add markdown cmdlets to default commands list 2018-07-12 17:17:50 -07:00
Aditya Patwardhan a78d006ac1 Added missing error messages 2018-07-12 17:17:50 -07:00
Aditya Patwardhan 481d3b1ebf [Feature] Add more tests 2018-07-12 17:13:55 -07:00
Aditya Patwardhan 275e109202 [Feature] Address code review comments 2018-07-12 17:13:55 -07:00
Aditya Patwardhan 32876c89e7 Added Tests for Markdown cmdlets 2018-07-12 17:13:55 -07:00
Aditya Patwardhan 75ba74cce6
Merge pull request #7242 from daxian-dbw/exp
Add support to experimental features

RFC: https://github.com/PowerShell/PowerShell-RFC/pull/114

Goals:

Allow experimental features to be declared by PowerShell engine and modules.
Allow experimental features to be enabled via powershell.config.json
Allow Function, Cmdlet, parameters and parameter sets to be shown to the user or hiden from the user depending on whether the associated experimetnal feature is on or off.
Allow discover experimental features using cmdlet Get-ExperimentalFeature
2018-07-12 15:52:04 -07:00
James Truher [MSFT] d61ea03694 Make pwsh able to start in a directory with wildcards in the name (#7240) 2018-07-12 15:10:31 -07:00
Steve Lee e5e1c53084 Add test to verify filesystem provider isn't used when accessing root path in psdrive (#7173)
* add test to verify filesystem isn't used when not in filesystem drive
2018-07-11 14:10:29 -07:00
Paul Higinbotham 040c494f94 Fixes to address ThreadJob tests reliability and speed (#7270)
This change merges Jim's fixes with some more I identified that will make the tests more reliable and faster to run.

The changes add functions to wait for the desired state instead of simply waiting a specified period of time, and also speeds up running job script execution time.
2018-07-11 13:00:08 -07:00
Dongbo Wang 0ac878f72c [Feature] Address Feedback: Fix style and xml doc issues. Update tests 2018-07-10 12:46:48 -07:00
Dongbo Wang 2c9519ba3b [Feature] Address Feedback: Use better error message and add more tests 2018-07-10 02:14:59 -07:00