Commit graph

5991 commits

Author SHA1 Message Date
Steve Lee f760fde0b7 Remove support for file to opt-out of telemetry, only support env var (#6601)
Since a PR added support to opt out of telemetry via an environment variable, we can remove the,
always intended to be a temporary, solution of deleting a file to opt out of telemetry since the
environment variable can be defined at the system level and exist before even installing PowerShell Core.

Because the variable is defined as opt out, a value of true, yes, or 1 means no telemetry is sent.
2018-04-13 10:29:39 -07:00
Steve Lee c2accff785 Support importing module paths that end in trailing directory separator (#6602) 2018-04-13 08:07:50 +04:00
Ilya f96a928a42
Re-order UFormat options in Get-Date (#6627)
Place in alphabetical order the options
2018-04-12 09:33:52 +04:00
Travis Plunk adce514a0c
fix error about setting readonly variable (#6617) 2018-04-11 11:01:38 -07:00
Sergey Vasin 25dbc68b8e Fix formatting in Add-Content.Tests.ps1 file. (#6591)
* Fix formatting.
* Capitalize TestDrive and add empty strings.
2018-04-11 07:23:30 +04:00
Dongbo Wang 118f771939
Make the 'PSISERemoteSessionOpenFile' a support event (#6582)
Make the `PSISERemoteSessionOpenFile` a support event, so that `Get-EventSubscriber` won't show that subscriber. `Get-EventSubscriber -Force` can still show the support event subscribers. `Unregister-Event -Force` needs to be used to remove a support event subscriber.

The event subscriber for `PSInternalRemoteDebuggerStopEvent` and `PSInternalRemoteDebuggerBreakpointUpdatedEvent` are already made support events. And this PR makes it the same for `PSISERemoteSessionOpenFile`.
2018-04-10 18:43:22 -07:00
Dongbo Wang 7726322589
Engine: Clean up unneeded 'GetTypeInfo()' calls in interpreter code (#6613)
Clean up unneeded `GetTypeInfo()` calls in interpreter code.
The `GetTypeInfo()` calls were added back in the early days of .NET Core, when most of the properties and methods of `System.Type` were removed. Now those properties and methods are back in `System.Type`, so there is no need to keep those calls.
2018-04-10 18:11:06 -07:00
Dongbo Wang 153d677839
Engine: Make some minor cleanup changes (#6609)
- Remove the calls to `GetTypeInfo()` in the generated `.resx` binding C# binding code (change in the tool `ResGen`).
- Remove the unused methods in `SessionState.cs`.
- Remove the calls to `GetTypeInfo()` from `Compiler.cs` and other files in `engine\runtime`.
- Fix typos in `VariableAnalysis.cs` and `ClassOps.cs`.
- Minor perf improvement in `MutableTuple.cs` by using indexing instead of linq extension method `last()`.
2018-04-10 18:03:20 -07:00
Ilya 68b59e3d9b Improve performance of parsing RegexOption for '-split' by using if branches (#6605) 2018-04-10 13:03:41 -07:00
Klaudia Algiz 3cd2308af9 Create the default PSSession configuration, not tied to a specific PowerShell version. (#6519)
Create the default PSSession configuration, not tied to a specific PowerShell version.

When Enable-PSRemoting command is run, it creates 2 sessions configurations:

first, the same as it was before with the name containing the current version expressed as: 'PowerShell.$PSVersionTable.GitCommitId'
second with the default name 'PowerShell.6' so that administrators wouldn't have to guess which specific version is installed on the target.
PR addresses the issue: #6470
2018-04-10 12:21:44 -07:00
Travis Plunk aefc0d89b0
make gem use sudo for macOS (#6610)
gem install requires sudo on official macOS build VMs.
- make bootstrap use sudo for macOS
2018-04-10 12:18:11 -07:00
Mark Kraus 18e6a5c654 Add Missing Start-WebListener to Web Cmdlet Tests (#6604) 2018-04-10 10:12:45 +04:00
Ilya 6bd70bc2d0
Some fixes in Get-Date -UFormat (#6542)
* Use UTC datetime in Get-Date -UFormat %s
Fix %l output from 0..11 to 1..12
Fix %V using Gregorian calendar

* Use a workaround for ISO 8601 week of year (uformat %V)
2018-04-10 08:13:19 +04:00
Jeffrey Snover 24dafac3f4 Added line break to Acess Denied error message. (#6607) 2018-04-10 07:51:06 +04:00
Sergey Vasin 3ec98bbbe8 Fix typos and formatting in Clear-Content.Tests.ps1 (#6592)
* Fix typos and formatting.
* Capitalize function parameters.
2018-04-10 07:47:39 +04:00
Sergey Vasin a3e8929d6a Fix formatting Clear-EventLog.Tests.ps1 (#6594) 2018-04-10 07:17:52 +04:00
Sergey Vasin ca5aacca16 Fix formatting in Clear-Item.Tests.ps1. (#6593) 2018-04-09 16:24:01 +04:00
Sergey Vasin 9d3c2633e7 Fix formatting in Convert-Path.Tests.ps1. (#6595) 2018-04-09 16:22:45 +04:00
Sergey Vasin 1f7b3a65d3 Fix Copy.Item.Tests.ps1 (#6596)
Fix formatting, absent parameter names and use -Throw and -ErrorID parameters with Should function.
2018-04-09 16:21:47 +04:00
Florian Feldhaus 94c8ce007d Added check for existence of Location HTTP header before using it (#6560)
The HTTP RFC (https://tools.ietf.org/html/rfc7231#section-6.4) does not require a Location header to be present for redirects, thus it is required to check if the Location header is returned before using it.
2018-04-08 16:51:17 +04:00
Dongbo Wang 48be625379
Improve PSMethod-to-Delegate conversion (#6570)
Two small improvements:
1. Avoid unnecessary reflection in `ConvertPSMethodInfoToDelegate`. `PSMethod` already has the `MethodInfo` information with its `adapterData` field.
2. Avoid creating the generic `PSMethod<>` type for `PSMethod` that represents constructors, because constructors cannot be converted to a delegate anyways. In case that the `PSMethod` represents constructors, we use a simple `PSMethod` instance instead.

Also, rename the type `Unit` to `VOID` to make it more readable, since that type represents `typeof(void)`.
2018-04-06 17:01:04 -07:00
Darwin 46fa2260a8 Update installpsh-<distrofamily>.sh Installers to Handle "preview" in version number (#6573) 2018-04-06 15:23:11 -07:00
Steve Lee 38c53c50a6 Support 'user@host:port' syntax for SSH Transport (#6558) 2018-04-06 15:04:37 -07:00
Sergey Vasin 4554679a08 Use -Throw and -ErrorId native Pester parameters. (#6574) 2018-04-06 16:15:37 +04:00
Ilya 31085d5737 Use C# latest language in proj files (#6559)
Address #6547

We begin using C# 7.2 features (Span) but .Net Core doesn't seem use "Latest" as default for a language.
So we explicitly set the value.
2018-04-05 17:39:20 -07:00
Dongbo Wang 2a45b48ae2
Remove the FullCLR-only symbol-info related code from 'EventManager.cs' (#6563)
This is because the `AssemblyBuilder` family types do not support emitting symbol information in .NET Core.
2018-04-05 13:57:05 -07:00
Dongbo Wang 6584447025
Engine: Fix several code cleanup issues (#6552) 2018-04-04 14:47:44 -07:00
Dongbo Wang e0b1f1f3af
Fix line ending in 'DefaultCommands.Tests.ps1' from CRLF to LF (#6553) 2018-04-03 13:32:16 -07:00
Dongbo Wang ceac82abc5
Fix running 'pwsh' produced from 'dotnet build' (#6549) 2018-04-03 12:06:14 -07:00
Ilya 24cf020442 Add ported Test-Connection cmdlet (#5328)
The Test-Connection cmdlet works on Windows and Unix.

Implemented:
Ping
Continues Ping
Traceroute
Detect MTU size (seems don't work on Unix because of .Net Core issue)
Connect to TCP port
Not jet implemented:
I'm putting this off for the future.

Detect blackhole routers
PingPath
Additional considerations
As you can see in the tests .Net Core has issues in API implementation. As a result, some tests are skipped on Unix. There is also one issue on Windows. Related comments added to tests.
I'm going to open an issue(s) in CoreFX repo.

I think we should break the feedback into two parts:

scripting functionality
interactive functionality (display output)
Now I have implemented the output to the screen as the progress bar and as text (without ETS) - we have to decide what is best to use.
2018-04-03 11:59:26 -07:00
Travis Plunk a267ca5216
Merge - Get the VisualStudio solution working (#6546)
Changing the project type GUID. This should make the TargetFramework not required to
build in Visual Studio for Windows (works on Mac without the change.)
Add the powershell-unix project so you can choose which one to build.
remove a resource that wasn't used and fails in VS from two resource files.
2018-04-03 11:32:10 -07:00
Takuya Shibata cd1d2d2063 Fix error when 'Format-Wide -AutoSize | Out-String' is called. (#6491)
* Add checking if an output width is specified.

* change _failedToReadConsoleWidth variable to _noConsole bool value. 
This variable is to cache the default console width when failed to get 'Console.WindowWidth' value.
2018-04-03 11:17:05 -07:00
Klaudia Algiz f0b6ef2eb4 Terminate the loop in PsUtils.GetMainModule() which was infinite in case there was no main module. (#6358)
* Terminate the loop in GetMainModule if main module is null.

* Run tests with FileVersionInfo also on non-windows platforms. Add test for process which main module can be null.
2018-04-03 10:58:06 -07:00
Travis Plunk 9b6c9af92a rename solution to powershell 2018-04-03 09:50:09 -07:00
Travis Plunk 78f797a3b8 Add comments about configuration mappings 2018-04-03 09:44:53 -07:00
Travis Plunk b3860452a2 add mappings for unix project 2018-04-03 09:36:46 -07:00
Travis Plunk 4ce9506d32 change project type for unix project 2018-04-03 09:35:10 -07:00
Travis Plunk 4e2089e5d9 add comment about project guids 2018-04-03 09:34:36 -07:00
Steve Lee 5d3456d11b Fix formatting of tables where headers span multiple rows (#6504)
* In cases where the header spans multiple rows, need to correctly calculate whitespace and trim appropriately

* Use System.Span<int> and C# 7.2 language in SMA

* Added new ref assemblies to Files.wxs
refactor tests to remove similar xml content
added single column test case
2018-04-03 07:24:23 +04:00
Travis Plunk 3547357b25 Map configurations to correct configurations
This reverts commit 9cbf601576.
2018-04-02 19:08:44 -07:00
Travis Plunk b63045c617 Add Unix project to sln 2018-04-02 18:22:37 -07:00
Staffan Gustafsson b1743dca01 Removing invalid resources to make Visual Studio builds compile. 2018-04-02 18:22:37 -07:00
Staffan Gustafsson 9cbf601576 Updating solution file with new project type guids 2018-04-02 18:22:37 -07:00
Dongbo Wang d1cf82ec20 Clean up workflow logic in the module loading component (#6523)
Clean up workflow logic in the module loading component.
Workflow module is not supported in PSCore.
Currently, Import-Module throws a terminating error when seeing .xaml modules. After the change, Import-Module throws a non-terminating error when seeing .xaml modules.
2018-04-02 16:18:56 -07:00
Aditya Patwardhan 610ae1a63f Update 'Update-Help' to save help content in user scope by default (#6352)
Add the parameter `-Scope` to `Update-Help`, which takes `AllUsers` or `CurrentUser`. The default value is `CurrentUser`.
2018-04-02 15:32:55 -07:00
Aditya Patwardhan 260c16ff4f
Mark Save-Help PackageManagement tests as pending (#6545) 2018-04-02 14:07:02 -07:00
Dongbo Wang 9e3ffb10e5
Remove duplicate 'Restore-PSPackage' (#6544) 2018-04-02 13:38:49 -07:00
Travis Plunk 77f36498e6
Simplify the paths the MSI uses (#6442)
- Implementation of PowerShell/PowerShell-RFC#115 (If anything changes in the RFC, we will treat it as a bug, and fix it later)
- Update registry and directory paths to use 6 for the version for stable and 6-preview for a preview release
- Add checkbox to set path
- default checkbox to off for preview builds and on for stable builds
2018-04-02 10:47:29 -07:00
Kevin Marquette 986a9eeecd Remove empty Should -Be statements (#6536) 2018-04-01 15:05:45 +04:00
Kevin Marquette e3ba6bd92c Fixed scenarios where NullOrEmpty string was used instead of -BeNullOrEmpty (#6535) 2018-04-01 15:05:08 +04:00