Commit graph

6206 commits

Author SHA1 Message Date
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
Dongbo Wang
c7c35bdcf3 [Feature] Address Feedback: make value tuple element types explicit 2018-07-09 17:51:19 -07:00
Dongbo Wang
b616cf578a [Feature] Address Feedback: style changes and fixing typo 2018-07-09 17:17:12 -07:00
Dongbo Wang
10334220e8 Address Feedback: functional changes and method/variable renaming 2018-07-09 17:14:34 -07:00
Dongbo Wang
2fce1bfe56 [Feature] Root caused test failure issue and fix it 2018-07-09 10:51:57 -07:00
Dongbo Wang
bc8abf8efa [Feature] Fix two tests 2018-07-06 13:28:20 -07:00
Dongbo Wang
d2e9151fff [Feature] Add tests for experimental feature work 2018-07-06 13:28:20 -07:00
Dongbo Wang
3c3ddeb127 Alter the analysis cache file name properly 2018-07-06 13:28:20 -07:00
Dongbo Wang
d8d3344e98 Generate logging resources for Unix platforms 2018-07-06 13:28:20 -07:00
Dongbo Wang
dc2d741791 Add logging, formatting, and '$EnabledExperimentalFeatures' 2018-07-06 13:28:19 -07:00
Dongbo Wang
7770aa547e Add 'Get-ExperimentalFeature' cmdlet 2018-07-06 13:28:19 -07:00
Dongbo Wang
8a5ddbb231 Support experimental feature in modules 2018-07-06 13:28:19 -07:00
Dongbo Wang
930350e2ee Update code that creates attributes to support the new attribute changes 2018-07-06 13:28:19 -07:00
Dongbo Wang
eed9842534 First batch: Basic experimental feature flag and attributes enforced 2018-07-06 13:28:18 -07:00
Ilya
b1a525923a
Remove dummy comments in Utility module files (#7224)
* Remove dummy comments (like } // dummy ) in Utility module files
* Fix new line at eof.
2018-07-06 13:50:13 +05:00
Meir Blachman
58e9b4969a Update docs for ArgumentCompleterAttribute class (#7227) 2018-07-06 08:34:45 +05:00
Paul Higinbotham
a57fafedc6 Add ThreadJob module package and tests (#7169) 2018-07-05 17:38:12 -07:00
Dongbo Wang
73d71d9a9c
Build: Fix the source location of PowerShell.Core.Instrumentation.dll (#7226) 2018-07-03 18:05:57 -07:00
Christoph Bergmeister
56e50ce632 Update 'Start-PSPester' to make it more user friendly (#7210)
- Make `Start-PSPester` call `Restore-Pester` automatically when needed,
- Make `-Path` a positional parameter for `Start-PSPester`.
2018-07-03 11:16:37 -07:00
Alex Jordan
55bbc3fcd1 Fix the name of a 'Register-EngineEvent' test (#7222) 2018-07-03 10:41:15 -07:00
Robert Holt
de41ca519c Refactor module specification logic (#7126)
* Use `nameof` where appropriate
* Factor out a repeated `entry.Key.ToString()` call
* Use a `StringBuilder` in the `ToString()` method
* Dissect a trick comparison method into something simpler
* Use HashCode.Combine() method
2018-07-03 11:18:12 +05:00
Staffan Gustafsson
3c079b9d42 Add type inference for Select-Object command (#7171)
Add type inference for Select-Object command

Fixes #7170
2018-07-02 13:23:30 -07:00
Bruce Payette
dbaa1add3a Methods with return type [object] should return null for an empty result (#7138) 2018-07-02 12:58:42 -07:00
Steve Lee
06960346a1 Enable UseShellExecute on all platforms (#7198)
Previously, we limited use of UseShellExecute when starting a new process to only Windows Desktop.  However, CoreFx now supports UseShellExecute (appropriately calling `open` on macOS and `xdg-open` on Linux) so we can have a consistent code and remove some of the existing redundant code or unnecessary limiting code.
2018-07-02 12:50:19 -07:00
Dongbo Wang
0d9a3ac832
Refactor module code related to 'Get-Module -ListAvailable' (#7145)
* The major refactoring changes are:
- In `ModuleIntrisic.cs`, remove unneeded Windows-PowerShell-only code.
- In `ModuleUtils.cs`
   - use the new API `Directory.GetDirectories(string path, string searchPattern, EnumerationOptions enumerationOptions)` and `Directory.GetFiles(string path, string searchPattern, EnumerationOptions enumerationOptions)` to enumerate files and sub-directories within a directory path.
   - remove the unused parameter `bool force` from `GetDefaultAvailableModuleFiles(bool force, bool isForAutoDiscovery, ExecutionContext context)`
   - refactor the method `GetModuleVersionsFromAbsolutePath`. Add more comments and rename the method name.
- In `ModuleCmdletBase.cs`, refactor the method `GetModuleForNonRootedPaths` to `GetModuleForNames` to simply its implementation.
- In `PSModuleInfo.cs`
   - group the declarations of `Declared*Exports` fields together
   - rename `_detected*Exports` fields to `Detected*Exports` to group them together. They are internal fields and used outside `PSModuleInfo`.

* There is some perf improvement after this refactoring change:
- For `Get-Module -ListAvailable`, there is about 36% speed improvement for 94 default modules.
- For `Get-Module -ListAvailable -All`, there is about 14% speed improvement for totally 600 module files.
- For `Get-Module <name> -ListAvailable -List`, there is over 17x speed improvement for finding 13 modules from 600 modules. This is because we now filter names using the module file before creating a `PSMdouleInfo` object.
2018-07-02 11:00:27 -07:00
PetSerAl
b12dce27ff Build: Fix a check to avoid null argument in case 'vcvarsall.bat' is absent (#7218) 2018-07-02 10:41:03 -07:00
Travis Plunk
c43ae6a110 Update 'releaseTag' in 'tools/metadata.json' (#7214) 2018-07-01 00:15:21 -07:00
Ilya
0a3555064a Use .Net Core File.Delete() method to remove symbolic links and alternate streams (#7017)
.Net Core support processing symbolic links and alternate streams, and thus we can remove our P/Invoke code.
2018-07-01 00:08:28 -07:00
Andrew
d04fef469b Merge Third Party Notices and License updates (#7203)
* Merge Third Party Notices

* Use capital J for 'json'
2018-06-29 11:46:19 -07:00
Steve Lee
3cc9d26bc2 Fix class searcher to ignore hidden properties (#7188) 2018-06-28 23:29:12 -07:00
Adam Gauthier
c83e0e8462 Update the powershell executable location in building guide docs (#7205) 2018-06-28 23:14:08 -07:00
Ilya
839ecb866f Move to dotnet core 2.1.1 (#7161) 2018-06-28 23:10:10 -07:00
Aditya Patwardhan
15f6abe944 Added functionality to retry in Invoke-RestMethod and Invoke-WebRequest. (#5760)
Added two parameters, RetryCount and RetryIntervalSec to enable retry functionality. When retrying a verbose message is sent out to inform the user.
2018-06-29 09:06:53 +05:00
Darwin
68ab1e09a6 Adding ability to install previews side-by-side with production releases (#7194)
-preview switch:
 - installs pwsh-preview packages when a package manager is being used.
 - uses link name pwsh-preview when tar ball install is being done
 - results in preview release being available for calling manually, but does not become systemwide version
Issue #7177
2018-06-28 11:46:58 -07:00
Bruce Payette
1d549497cf Modified the -AsHashTable code to get the base object from the PSObject when (#7123) 2018-06-28 12:29:04 +05:00
Sergey Vasin
adf267eb5f Fix second test in Send-MailMessage.Tests.ps1. (#7195) 2018-06-28 10:02:10 +05:00
Steve Lee
057eeddbd6 when using PSRP, if we receive text instead of xml, output it as error to help troubleshoot (#7168)
PSRP currently relies on XML for the transport messages.  When using PSRP over SSH, if the target side fails, it sends back a text message.  PSRP sees this and doesn't know what to do so it throws
a generic message which makes troubleshooting the issue more difficult.  Change here is to throw
the text message which now looks like:

>new-pssession : [test-machine] There is an error processing data from the background process. Error reported: Invalid argument '-np', did you mean:.

Previously:

>new-pssession : [test-machine] There is an error processing data from the background process. Error reported: Cannot process an element with node type "Text". Only Element and EndElement node types are supported..

Since it's processing one line at a time, not able to get the whole message.
2018-06-27 15:42:06 -07:00
Steve Lee
167b51c4d6 update build and packaging modules for Alpine (#7149) 2018-06-27 15:30:38 -07:00
Dan Travison
5e8b23e127 Allow Basic Auth over HTTPS (#6890)
* [FEATURE] Allow Basic Auth over HTTPS

* WSManTransportManager.cs: Simplify HTTPS check
Update comment in test to refer to the right exception type.

* Disable test until limi crash fo selected connection error paths is fixed

* Use Hex format for defining the expected HRESULT
2018-06-27 15:27:41 -07:00
Steve Lee
5f47fc0e8c Fix tab expansion for Get-Process on macOS (#7176)
* fix tab exapnsion for get-process on macOS

* add comment to address PR feedback
2018-06-27 12:48:42 -07:00
Robert Holt
dfa1a31515 Add tests for module specifications (#7140)
* Add simple tests for module specifications

* Add comparison tests

* Add using namespace to shorten type names
2018-06-27 12:11:32 -07:00
Steve Lee
8829c01fa2 [feature] (#7101)
Revert "Set-Location should use path with wildcard characters if it exists instead of globbing (#5839)"

This reverts commit 7459b54639.
2018-06-27 10:26:37 +05:00
Steve Lee
b1fbcee6d2 Fix trimming of whitespace when table is wrapped (#7184) 2018-06-27 10:24:03 +05:00
Sergey Vasin
7628f8819d Send-MailMessage: Update all parameters to support 'ValueFromPipelineByPropertyName'. (#6911) 2018-06-26 12:30:07 -07:00
Bruce Payette
bacda46941 Fix the pref regression to the '-replace' operator after adding ScriptBlock support (#7135) 2018-06-26 12:27:16 -07:00
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