Commit graph

4812 commits

Author SHA1 Message Date
Staffan Gustafsson f959c41e71 Add Hashtable tab completion for -Property of select-object (#3625)
Also added more tab completion tests.
2017-04-24 16:45:05 -07:00
Paul Higinbotham b5f10ecba2 Added requested comment (#3640) 2017-04-24 16:21:21 -07:00
Ilya 6db5c945b2 Remove unused and duplicated GetEncodingFromEnum (#3487) 2017-04-21 18:07:54 -07:00
Paul Higinbotham a16b71bad4 SSH Remoting should handle multi-line error messages from SSH client (#3612)
* Fix to support multi-line error messages from SSH client

* Fixed resx file

* Added null check

* Added Environment.NewLine
2017-04-21 18:01:11 -07:00
Ilya e8ec40069b Improve ValidateCount attribute error message (#3596) 2017-04-21 18:01:04 -07:00
James Truher [MSFT] 63c20f15b1 Add dockerfile and test so we can test simple remoting behaviors (#3470)
* Add dockerfile and test so we can test simple remoting behaviors

this docker file creates an image which can be used to test remoting with containers.
We start with the microsoft/windowsservercore image and then set up the system for
testing by adding a user, setting up configuration for basic auth, installing
PowerShell Core, and creating a configuration endpoint for PSCore.

The tests are very simple; it retrieve $PSVersionTable.PSVersion in the following
connections:
   Full -> Full
   Full -> Core
   Core -> Full
   Core -> Core

* Add new file to bootstrap the docker image

fix the tests to be more resilient to changes in the version of the PSCore package

* update script to use local user cmdlets rather than net.exe

also remove pscore.msi at the end of the image build process to save space

* clean up commented lines and remove an unused parameter from one of the functions

also use constants more consistently

* remove reference to docker image name by string and use variable instead.
2017-04-21 17:23:08 -07:00
jeffbi 8183732d99 Use more accurate test to check if source and destination paths are pointing the same file (#3441)
Rather than relying on case-insensitive string compares of source and destination paths, use operating system calls to determine whether two paths refer to the same file. This solves not only the case-insensitivity issue but also allows the cmdlet to operate properly if the destination is a hard or symbolic link to the source.
The Windows side is implemented in C#. The Unix side is implemented partially in native code.
2017-04-21 16:09:53 -07:00
Dongbo Wang dc6b91a672 Fix the Read-Host test that fails in OSX (#3609) 2017-04-20 15:12:31 -07:00
Staffan Gustafsson fa901b646f Add ErrorMessage property to ValidatePattern, ValidateSet and ValidateScript attributes (#2728)
This makes it possibe to write for example
[ValidatePattern('[A-Z]:',  ErrorMessage='The Drive should be specified as a single letter followed by a colon, for example "D:"')]
[string] $Drive,

The element being validated is also passed, so {0} can be used in the custom error message
2017-04-20 11:31:57 -07:00
Dongbo Wang e8a0f3ca63 Fix web cmdlet tests and the error message for 'Get-Member -input $null' (#3602) 2017-04-19 18:20:45 -07:00
Dongbo Wang 1c1c75318e Add 'x' permission to crossgen on Linux and OSX (#3592) 2017-04-18 16:51:18 -07:00
Chunqing Chen e3d4c95a77 New-Item -ItemType SymbolicLink cannot understand directory path ending with slash on Linux (#2974) 2017-04-18 15:40:25 -07:00
Dongbo Wang 79a1f80309 Update build script to always use 'dotnet publish' (#3589)
Also update 2 building docs
2017-04-18 13:12:35 -07:00
Dongbo Wang 7a55bf98b2 Move powershell to .NET Core 2.0 (#3556)
This change moves powershell to .NET Core 2.0. Major changes are:
1. PowerShell assemblies are now targeting `netcoreapp2.0`. We are using `microsoft.netcore.app-2.0.0-preview1-001913-00`, which is from dotnet-core build 4/4/17. We cannot target `netstandard2.0` because the packages `System.Reflection.Emit` and `System.Reflection.Emit.Lightweight`, which are needed for powershell class, cannot be referenced when targeting `netstandard2.0`.
2. Refactor code to remove most CLR stub types and extension types.
3. Update build scripts to enable CI builds. The `-cache` section is specified to depend on `appveyor.yml`, so the cache will be invalidated if `appveyor.yml` is changed.
4. Ship `netcoreapp` reference assemblies with powershell to fix the issues in `Add-Type` (#2764). By default `Add-Type` will reference all those reference assemblies when compiling C# code. If `-ReferenceAssembly` is specified, then we search reference assemblies first, then the framework runtime assemblies, and lastly the loaded assemblies (possibly a third-party one that was already loaded).
5. `dotnet publish` generates executable on Unix platforms, but doesn't set "x" permission and thus it cannot execute. Currently, the "x" permission is set in the build script, `dotnet/cli` issue [#6286](https://github.com/dotnet/cli/issues/6286) is tracking this.
6. Replace the use of some APIs with the ones that take `SecureString`.
7. osx.10.12 is required to update to `netcoreapp2.0` because `dotnet-cli` 2.0.0-preview only works on osx.10.12.
8. Add dependency to `System.ValueTuple` to work around a ambiguous type identity issue in coreclr. The issue is tracked by `dotnet/corefx` [#17797](https://github.com/dotnet/corefx/issues/17797). When moving to newer version of `netcoreapp2.0`, we need to verify if this dependency is still needed.
2017-04-17 11:52:38 -07:00
jeffbi 06020f34e5 Fix New-Item to create correct symlink type (#2915) (#3509)
Now `New-Item` can create a file symlink to a file target or to a non-existent target. It can also create a directory symlink to a directory target on Windows.
2017-04-14 14:23:14 -07:00
Steve Lee 2851f7e800 Accept -i for an interactive shell (#3558)
On Unix, it is a convention for shells to accept `-i` for an interactive shell and many
tools expect this behavior (`script` for example, and when setting powershell as the
default shell) and calls the shell with the `-i` switch.  This change is breaking in
that `-i` previously could be used as short hand to match `-inputformat` which now will
need to be `-in`.
2017-04-13 18:35:26 -07:00
George Chakhidze 47ec6b2a86 Use IntPtr(-1) for INVALID_HANDLE_VALUE instead of IntPtr.Zero (#3544)
- Fix incorrect handling of 'GetCurrentProcess()' API return value in 'IsWow64()' function (MainEntry.cpp)
- Remove unused INVALID_HANDLE_VALUE field from 'ProcessNativeMethods' class (Process.cs)
2017-04-13 17:00:56 -07:00
Ilya 4ad4b194fc Convert tab indentations to spaces in *.cs files (#3551)
Prepare to pass meta test.
2017-04-13 13:45:46 -07:00
Ilya acec58c049 Make the output of $PSVersionTable in alphabetical order (#3530) 2017-04-12 22:04:53 -07:00
Ilya f0c0176aa2 Typo in Format-Hex (#3539) 2017-04-12 10:43:18 -07:00
probonopd 3516872144 Use /bin/bash, fixes #3525 2017-04-12 08:57:26 -07:00
Travis Plunk 8d4db01a5d Add sudo for adding cert for OpenSUSE (#3524) 2017-04-11 13:37:53 -07:00
Travis Plunk 68bcd4b528 Removed trailing whitespace (#3485) 2017-04-11 09:44:43 -07:00
Travis Plunk 18c28f8fc7 Fix markdown lint issues for SSH Remoting demo and enable related tests (#3484) 2017-04-11 09:42:37 -07:00
Chris Dent 4697dd2b38 Adding public ValidRootDrives property to ValidateDrive (#3510) 2017-04-11 09:40:01 -07:00
Steve Lee 753b1965a0 Fix crash at startup when env:HOME not set (#3437)
There are cases like using PowerShell via Puppet where the account being
used does not have a home directory.  Updated PowerShell to use a process
specific temporary directory if HOME, CONFIG, CACHE, and DATA directories
are not available.  Temporary directory is removed when last runspace
is disposed.
2017-04-09 09:23:06 -07:00
Travis Plunk 9b3d82b7b4 Update windows docker hashes and labels (#3508) 2017-04-07 14:10:08 -07:00
Dongbo Wang 64f52edbd5 Update docs to use the new windows package names (#3507) 2017-04-07 12:03:29 -07:00
Dongbo Wang b5c1473484 Alpha.18 release doc updates (#3492) 2017-04-06 21:27:48 -07:00
Ilya 0883438e55 Fix Default/OEM encoding behavior PowerShell Core (#3467)
Based on the conclusion in discussion #3248, this PR fix "OEM" and "Default" encoding in powershell.
1. OEM -- We need an internal fix because .Net Core has no "OEM" encoding.
The fix gives the following PowerShell Core behavior on "OEM" encoding:
   - on Windows - as Windows PowerShell based on GetOEMCP() and legacy encodings (System.Text.Encoding.CodePages)
   - on Unix - the same as default encoding in PowerShell Core

2. Default -- We need internal fix because CoreFX `Encoding.default` for all platforms is UTF8.
Until we complete the `Encoding RFC` we should restore behavior as in Windows PowerShell.
The fix gives the following PowerShell Core behavior on "Default" encoding:
   - on Windows - as Windows PowerShell based on GetACP() and legacy encodings (System.Text.Encoding.CodePages)
   - on Unix - UTF-8 without BOM (We are expecting that the same will be [in CoreFX](https://github.com/dotnet/coreclr/issues/10643))
2017-04-05 18:22:18 -07:00
Travis Plunk 459b0b5f29 OpenSUSE42.1 docs update and download.sh (#3478) 2017-04-04 17:41:40 -07:00
Travis Plunk 8de8b19505 Silently don't set execution policy for Unix machines (#3481) 2017-04-04 16:53:36 -07:00
Steve Lee 2d8d59e4e0 Update SSHRemoting demo README.md (#3471) 2017-04-04 14:16:50 -07:00
Dongbo Wang 3be547c78e Skip the parser tests that are run by 'ShouldBeParseError' in Travis Full Build (#3479) 2017-04-04 09:23:51 -07:00
Dongbo Wang a79cb2ffd2 Replace 'libpsrpclient' with 'psrp' package (#3477)
The package 'libpsrpclient' was replaced by 'psrp' in #3271. However, this was missed when moving from project.json to MSBuild. This change makes this update.
2017-04-03 16:40:06 -07:00
Rune Darrud 42f2e3ca82 Fix tests to work as expected under Linux (#3474)
- Removed the -TimeoutSec option and modified the expected Error to be consistent across platforms.
- Changed the port of the phony proxy to 9 which is reserved for the Discard Protocol. So even if the system is listening, it's supposed to discard that TCP request (UDP may use it for Wake-on-Lan, but doesn't affect this).
2017-04-02 17:31:22 -07:00
PetSerAl f76b2fcbaf Make Out-Default -Transcript more robust in how it handles TranscribeOnly state (#3436) 2017-04-01 16:36:04 -07:00
Rune Darrud a770ecd686 Add option -NoProxy to WebCmdlet 2017-03-31 18:02:59 -07:00
Travis Plunk 64230566f8 Refer to Windows docker images license in main readme (#3469) 2017-03-31 12:34:01 -07:00
Steve Lee 2cfe3d57a6 Fix progress bar display when cursor not at left edge
Fix by saving the cursor position, displaying the progress, and restoring the cursor back to the original position so normal formatting (e.g. table output) can continue.

Closes #3453.
2017-03-31 11:38:01 -07:00
Ilya 544e466e15 Fix 'StringBuilder' initialization (#3458) 2017-03-31 09:31:11 -07:00
Travis Plunk 7ceb1f6b84 Add entry points to the windows docker files (#3462) 2017-03-31 09:23:47 -07:00
Travis Plunk 9efbf56dd7 fix hashes for windows docker files (#3454) 2017-03-30 08:36:13 -07:00
Ilya 46cc634854 Fix typo in Scripting.Classes.BasicParsing.Tests.ps1 (#3459) 2017-03-30 08:35:06 -07:00
Travis Plunk 7e5814abf5 Expand md lint tests (#3451) 2017-03-29 17:13:19 -07:00
Ilya c705dbd0a7 Add test to verify approved aliases list (#3380) 2017-03-29 14:53:40 -07:00
Raghu Shantha [MSFT] d2d80c6832 Use Product Semantic version in the MSI installer where possible (#3435) 2017-03-29 13:36:44 -07:00
Ilya 39be7109d4 Add tab completion for Select-Object -ExcludeProperty -ExpandProperty (#3443) 2017-03-29 10:36:18 -07:00
Ilya 27b27cc43a Autoload TestRemoting.psm1 (#3430) 2017-03-29 10:11:02 -07:00
Steve Lee 4d0e21f6d2 Add "cache-control:no-cache" and "last-modifed" to headers to prevent GitHub CDN from caching Travis nightly badge (#3449) 2017-03-28 22:15:52 -07:00