Commit graph

6199 commits

Author SHA1 Message Date
Aditya Patwardhan
5702e3f57a Added markdown rendering feature assemblies to the trusted assembly list (#7280) 2018-07-12 14:19:19 -07:00
Robert Holt
6a66a6e0f0 Add more information to job process failure error (#7251) 2018-07-12 08:06:07 +05:00
Travis Plunk
79d20a1873
Update PowerShell Direct to try pwsh then fallback to powershell (#7241)
Update PowerShell Direct to try pwsh then fallback to powershell

  - Forward port changes from Windows Powershell to fall back
  - change the order from powershell->pwsh to pwsh->powershell

fixes #7237
2018-07-11 15:44:31 -07:00
Aditya Patwardhan
749d1609bb
Update README files for native code for migration (#7248) 2018-07-11 14:32:01 -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
Christoph Bergmeister [MVP]
ef10460172 Make 'Start-PsBuild -Clean' not prompt due to locked files when Visual Studio is open by excluding sqlite3 folder and use -x instead of -X option on git clean (#7235)
* Exclude sqllite  folder when cleaning and use -x instead of -X option

* Remove 2nd git clean block which is redundant now
2018-07-09 10:16:56 -07:00
PRASOON KARUNAN V
9dcfddde9e Adding -AllStats Switch parameter for Measure-Object cmdlet (#7220) 2018-07-09 08:45:32 +05: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
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