Commit graph

6360 commits

Author SHA1 Message Date
Dongbo Wang 13e925e13e
Revert "Make switch statement report correct error position when it fails to evaluate the condition" (#7182)
The fix causes a problem in debugging. When stepping over the scripts in debugging mode, the debugger will stop at the switch statement condition expression twice at the very beginning -- one for evaluating the condition, and one for iterating the condition.
2018-06-26 12:24:11 -07:00
Steve Lee e8d2a6b278 Fix adding padding when right justified (#7136)
Table formatter was overly aggressive in removing padding so even right justified output (default of numbers) gets incorrectly stripped of padding. Fix is when right justified, always add padding (because it's right justified, there's never trailing whitespace).
2018-06-26 12:35:22 +05:00
Christoph Bergmeister bbd48f60e0 Add location history for Set-Location to enable 'cd -' scenario (issue #2188) (#5051)
* Implement location history feature for Set-Location.
This makes it possible to go back to the last directory using 'cd -',
which is exactly the same syntax as on Linux shells.

* Use an existing stack implementation instead of relying on an environment variable and move logic for 'cd -' into the internal class of SessionState.Path.SetLocation
Keep the (additional) setting of an environment for Unix system in case of mixed usage of cd and Set-Location to provide consistency.

* Use a bounded stack with a limit of 1000 and adapt tests.
Remove setting environment variable on Linux as discussed in PR.

* Fix test: use get-location explicitly to avoid subtle difference in the path string (e.g. an additional slash at the end)
Make syntax to .net call of environment consistent with surrounding code

* Move initialization of _workingLocationHistoryStack into constructor of SessionStateInternal and set the limit to 20 as discussed in PR 5051.

* Make new BoundedStack class in engine utils internal
2018-06-26 12:21:38 +05:00
Steve Lee 7d72e38604 Updates to build for Alpine (#7139)
setdate.cpp was incorrectly assigning an int to a struct, fixed to initialize struct zero'd
update the typegen project in the bash script
added some help text at top of script for someone trying to build it
updated runtime to linux-musl-x64 instead of linux-x64 as Alpine distro uses the musl libc libraries instead of glibc which is used by most distros.
2018-06-25 14:51:30 -07:00
Ilya 4fc784e840 Bulk update code base to put 'null' on the right-hand-side of a comparison expression (#6949) 2018-06-25 14:37:09 -07:00
Dongbo Wang c77d0ceff2
Make switch statement report correct error position when it fails to evaluate the condition (#7151) 2018-06-25 14:07:42 -07:00
Darwin 53e6ec6ead install-powershell.sh filter prereleases (when available), params documentation (#6849)
Fixed #6815 by adding -allowprereleases parameter
Fixed #6405 by adding -allowprereleases parameter
Added parameters to documentation
Ready for prerelease repositories if Microsoft starts providing them
Added -skip-sudo-check for all distros
Fixed -interactivetesting should do nothing if -includeide was not used
2018-06-25 11:44:42 -07:00
Sergey Vasin ffca008726 Fix error when using Get-ChildItem c: (#7033)
* Fix error when using Get-ChildItem c:

* Fix New-Item test issue.

* Add tests for Get-ChildItem cmdlet.

* Add tests for New-Item cmdlet.

* Fix tests for New-Item cmdlet.
2018-06-25 10:15:57 -07:00
Robert Holt 9413fd3802 Remove MapSecurityZoneWithUrlmon method and related code (#7103) 2018-06-24 23:46:12 -07:00
Bruce Payette bbb4f2ea84 Fix for #4520 '-ArgumentList should accept @() or $null' (#6597)
* Fix for #4520 '-ArgumentList should accept @() or $null'
Removed the [ValidateIsNotNulOrEmpty] attribute from the parameter.

* Fixed null and @() empty list tests to not both test null

* [Feature] Fixed test issue on non-Windows; added code to suppress displaying new windows on Windows.
2018-06-22 11:29:46 -07:00
Steve Lee 4ad56b3029 Remove PSReadLine from Solution (sln) file (#7137) 2018-06-22 23:22:24 +05:00
Steve Lee 6c9eea6390 Add back ADSI and WMI type accelerators (#7085) 2018-06-21 09:57:14 -07:00
Aditya Patwardhan d76cdc3c5c Fix New-TemporaryFile online help URI (#6608) 2018-06-20 12:15:50 -07:00
Dongbo Wang f591f4d61f
Comment about dynamic members for the DotNetAdapter 'GetMember' and 'GetMembers' (#7087) 2018-06-20 00:23:55 -07:00
Bruce Payette 3a4c410499 Fix for #6855 - Measure-Object should handle scriptblock properties. (#6934)
Measure-Object should handle `ScriptBlock` properties. Fixed by renaming `MshExpression` to `PSPropertyExpression` and making it public. Then in `MeasureObjectCommand`, lifting it up to the parameter level. Previously the implementation exposed the Property as a string and
wrapped it internally as a `PSPropertyExpression`. Now the parameter type is `PSPropertyExpression` directly allowing for both wildcard strings and `ScriptBlock`.

`PSPropertyExpression` now lives in a public namespace where it can be used by cmdlet and script authors to easily add the same type of functionality to their commands. I also modified `PSPropertyExpression` to handle hashtables properly as objects so
         @{prop = 3} | measure-object prop
and
         @{prop = 3} | measure-object {$_.prop}
will work the same. (Previously the example using just the property name would fail.)
2018-06-20 00:23:11 -07:00
Steve Lee b25c1f6cbb When installing using MSI, set the working directory of the shortcut to the user home directory (#7072)
Leverage the -WorkingDirectory parameter on pwsh.exe to set the initial location.

Fix #5705
2018-06-19 18:33:01 -07:00
Steve Lee abcdce4e3e Don't fail if SaferPolicy API is not available on Win10 IoT or NanoServer (#7075)
* don't fail if SaferApi is not available
* fix install-powershellremoting to work on Windows PowerShell 5.1
2018-06-19 17:53:32 -07:00
Dongbo Wang bda8fd376c Use empty array for Functions/Cmdlets/AliasesToExport to follow the best practice (#7108) 2018-06-19 17:51:28 -07:00
Dongbo Wang d6250e8086
Revert the PR #7023 "Set the cursor to the place where a user hits tab key" (#7117)
Reverts PowerShell/PowerShell#7023 due to a regression introduced by it.
2018-06-19 17:40:29 -07:00
Aleksandar Nikolić bd598f3f1e Fix typos in DOCSMIGRATION.md (#7094) 2018-06-19 08:24:35 +05:00
Christoph Bergmeister 0487a1be2f Disambiguate icon on Windows for preview builds/installers to use Powershell_av_colors and make daily build use Powershell_avatar instead (#7086)
Closes #6317
Using the preview side-by-side with the RTM version is a pain/confusing due to the icons being the same.
This makes the preview build (i.e. the embedded icon in `pwsh.exe`) and MSI installer package (shortcut icon and context menu) use the [Powershell_av_colors icon](https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/Powershell_av_colors.ico)
![image](https://user-images.githubusercontent.com/9250262/41491336-6e354936-70f0-11e8-965e-9b5e83be925b.png)

Therefore change the icon of the daily build (which used to use the Powershell_av_colors icon) to [Powershell_avatar](https://raw.githubusercontent.com/PowerShell/PowerShell/master/assets/Powershell_avatar.ico)
![image](https://user-images.githubusercontent.com/9250262/41491346-80f890a0-70f0-11e8-9ab5-bb789454c134.png)
This means that people like me who have a shortcut to pwsh of the daily build pinned to the taskbar, probably need to re-pin it to the taskbar to receive all changes (otherwise one will only get the change in the icon of the window)

Note: The `Test-IsPreview` method had to be moved to the build module, which is OK because the packaging module has a declared dependency on the build module in its manifest.
2018-06-18 15:54:11 -07:00
Jan Pazdziora 8489532f25 Fedora 28 was released, Fedora 26 and 25 were EOL'ed. (#7079)
With PowerShell/PowerShell-Docs#2497 merged, the links from README.md are no longer valid.
2018-06-18 15:27:57 -07:00
Hubert Bukowski 9ac701dbee Fix conditions for transcription of Write-Information command. (#6917)
Makes a transcription of Write-Information command consistent with $InfomrationPreference variable.
2018-06-16 21:11:21 +05:00
Dongbo Wang 00b0af13d8
Add 'CompatiblePSEditions' to PowerShell Core built-in modules (#7083) 2018-06-15 15:28:58 -07:00
Travis Plunk a5ec565cae
Enable NuGet Package Registration for compliance (#7053)
update the Windows release build script with the ability to capture all the project.assets.json files
add a Windows build to use the new feature in the release build script
update the Linux release build script with the ability to capture all the project.assets.json files
  -no new build is needed because signing is not currently automated
2018-06-15 11:07:27 -07:00
Paul Higinbotham 6fa1e86f2d Added copy env vars from ProcessStartInfo to key/pair array used in creating ssh process (#7070)
This addresses issue #6207. During SSH remoting on Linux machines, when PowerShell on the client creates the SSH process to connect to the target machine, it was not passing in environment variables from the parent process, and this was preventing ssh-agent key management from working.

This change adds a helper function to create environment variable key/value pairs for the created SSH process, based on the passed in ProcessStartInfo object.
2018-06-15 11:06:38 -07:00
Jianyun 8805ca20aa Set the cursor to the place where a user hits tab key (#7023) 2018-06-14 23:04:31 -07:00
Sergei Vorobev 69977718db Add instructions to update homebrew formula for the preview version powershell (#7067) 2018-06-14 12:03:17 -07:00
Ilya 81244fb907 Avoid calling native APIs to check for existence of FileSystem items (#6929)
- Use File.GetAttributes() instead of p/invokes to check for existence of FileSystem items. The method throws access exceptions which we use for better error messages.
- Remove the word 'Native' from method names.
2018-06-14 11:35:44 -07:00
Dongbo Wang 9141a3599f Update 'internals.md' with the latest build changes (#7058) 2018-06-14 23:06:16 +05:00
Travis Plunk 4342922268
make sure all references to the Pkg ID for previews packages is powershell-preview (#7066)
* make sure all references to the Pkg ID for previews are com.microsoft.powershell-preview
fixes #7065
2018-06-14 10:01:09 -07:00
Kyle Sabo 79ae17a39b Fix Windows Event Log channel isolation semantics (#6956)
- Remove isolation attribute from Analytic and Debug channels. These channel types always have an isolation of Custom, regardless of what is put here in the manifest.

- Since no events are being written to the Admin channel currently, remove it. This avoids the Windows Event Log pre-allocating a file for the channel.
2018-06-14 10:27:15 +05:00
Dongbo Wang 87bec49b27 Cleanup: remove the unneeded type 'RemotingCommandUtils' (#7029) 2018-06-14 08:35:55 +05:00
Robert Holt 7e05226dd5 Fix markdown and spelling errors in CHANGELOG.md (#7064) 2018-06-13 17:53:55 -07:00
Dongbo Wang 74628b61f6
Fix the preview macOS package link (#7061) 2018-06-13 16:15:39 -07:00
Dongbo Wang 9804ae5f97
Merge the v6.1.0-preview.3 release branch to master (#7060) 2018-06-13 15:59:27 -07:00
Paul Higinbotham 3eec0c42b2 Removed unneeded code that forces ARM platforms to run PowerShell in CL mode (#7046) 2018-06-13 12:01:32 -07:00
Dan Thompson ce3cb68551 Make Select-Object/ForEach-Object/Where-Object see dynamic properties (#6898)
Dynamic (DLR) objects work in some places today, but not others.  This change expands that support to ForEach-Object, Where-Object and the family of cmdlets that use 'MshExpression' (Select-Object, etc.).

This change addresses both wildcard and non-wildcard cases. In wildcard cases, it uses the existing support of generating PSDynamicMember objects for names returned by GetDynamicMemberNames.

In non-wildcard cases, a dynamic property access is attempted whether or not the name shows up in GetDynamicMemberNames, but a truly "blind" access is only attempted if we see that the base object is an IDMOP. If the dynamic access fails, you'll get the same or a similar error experience as before ("The property 'Blarg' cannot be found", or no error at all, depending on the cmdlet and the strict mode setting).

The included test coverage includes a stub for the.ForEach operator--once people are happy with this change, I can continue by adding support there.

This change should allegedly also have positive perf impact, though in actual perf testing, although it does seem ever-so-slightly faster, I found it difficult to measure much difference at all.
2018-06-12 23:48:34 -07:00
Dongbo Wang 3a5a3e4c6e Remove unneeded "Windows-Full" modules (#7030)
- Remove the Windows-Full folder under src/Modules
- Move content in Windows-Core+Full and Windows-Core to Windows under src/Modules
2018-06-13 09:06:41 +05:00
Steve Lee c2bbc2291a add additional checks for test that passes inconsistently (#7051) 2018-06-12 14:35:19 -07:00
Ilya e177fcaef6 CodeFactor code style cleanup: replace literal empty strings with 'string.Empty' (#6950) 2018-06-12 12:30:10 -07:00
Steve Lee 11a98c47fb Update third party notices (#7042)
Based on adding a reference to new assemblies, need to update ThirdPartyNotices.txt
Add ThirdPartyNotices to all packages
2018-06-12 10:58:05 -07:00
Aditya Patwardhan 0d67d4dc3a Merged PR 3115: Use Directory.CreateDirectory instead of DirectoryInfo.CreateSubDirectory
Change to use Directory.CreateDirectory because of regression introduced by https://github.com/dotnet/corefx/pull/27810 in creating a subdirectory under root path.
2018-06-11 23:06:08 +00:00
Christoph Bergmeister fbbca53f4c AppVeyor build matrix: more efficient build job split to reduce total time by another 5 minutes (#7021)
Closes #6944

Following PR #6945, further, reduce the total build time (without any disadvantages) by around 5 minutes by making sure there is a more even split between the 2 build jobs (the 2nd build job used to be much shorter).
Therefore this PR moves also the xUnit and Pester-Admin tests into the 2nd build job. If it is a daily/feature test commit, then the feature tests will also happen (only) in the 2nd build job. Because both jobs now run tests, the failfast option was removed. The final question from my side is whether running tests in 2 build jobs is OK for the daily build, which uploads code coverage results?

The time to wait for the AppVeyor build results is now 15 +/- 2 minutes, which is a huge improvement to what used to be around 28 minutes before the build matrix was introduced.
2018-06-11 14:18:51 -07:00
Travis Plunk f08a031f88 Merged PR 3079: Resolve Linux SxS conflicts and issues
Fix man page conflict between stable and preview Linux package
  - rename preview man page pwsh-preview
Fix /etc/shell entries not being created correctly for preview packages
2018-06-08 23:31:38 +00:00
Steve Lee 50d061148d Remove 'SemanticVersion' from 'knowntypes' list in serialization code to enable interop between WinPS and PSCore (#7016)
PowerShell serialization has a list of known PowerShell types. When an object is deserialized containing a known type it tries to deserialize the object to that specific type and throws an exception if it can't succeed. SemanticVersion only exists in PSCore6 so when remoting from Windows PowerShell or importing clixml generated from PSCore6 that contains SemanticVersion, it fails.

With this fix, it will be rehydrated as a "PSObject" with "Deseriealized.System.Management.Automation.SemanticVersion" in the 'TypeNames' in both Windows PowerShell and PowerShell Core.
2018-06-08 11:38:14 -07:00
Christoph Bergmeister fa544c33db Update links that contain 'en-us' culture (#7013)
Update links that contain 'en-us' culture to remove 'en-us' culture (if possible) and in some cases update to newer re-directed link to docs.microsoft.com
2018-06-08 10:49:03 +05:00
Dongbo Wang d8a2861fa9 Update versions in README.md 2018-06-07 23:02:21 +00:00
Dongbo Wang 6c914c0faa Update the ChangeLog.md for 6.1.0-preview.3 release 2018-06-07 21:15:03 +00:00
Dongbo Wang e9e8dc2313
Add Andrew to the default reviewers of the build related files (#7019) 2018-06-07 12:55:14 -07:00