Commit graph

1847 commits

Author SHA1 Message Date
Francisco Gamino 89a5c17d6b Fixing 'InFile parameter of Invoke-WebRequest doesn't work' and adding aliases (iwr for invoke-webrequest and irm for invoke-restmethod) to the web cmdlets. (#2848)
* Fixing Invoke-WebRequest InFile parameter

* Adding aliases for Invoke-RestMethod and Invoke-WebRequest

* Adding test cases for Web cmdlets -InFile parameter

* Adding tests for Invoke-WebRequest (iwr) and Invoke-RestMethod (irm) using the cmdlet aliases.

* Remove the extra leading space
2017-02-01 10:14:24 -08:00
Noutlaw1 edf685dc9c Added alias (Path) to the FilePath parameter of the Out-File cmdlet. (#2945)
* Added parameter alias to the Out-File cmdlet, allowing -FilePath to be used as -Path.

Relevant issue: https://github.com/PowerShell/PowerShell/issues/2923

* Test to confirm the alias I added to the Out-File cmdlet's -FilePath parameter works.

* Changed test for parameter alias as per feedback.

* Updating based on feedback.

Made formatting changes:
Added space between brackets and start of cmdlet.
Moved end bracket to before the pipe and Should Not Throw statement.
Removed -InputObject parameter for the test, as it was not needed.

* Added BeforeAll to the first part of the file. Replaced tabs with spaces.

#2945

* Fixing indentation within the test file
2017-01-26 14:17:40 -08:00
Jason Shirk 110878ca05 Cache padding strings up to 120 spaces (#3036) 2017-01-25 18:19:08 -08:00
Mike Richmond f2b9f7d5ab Add WindowsUBR to Get-ComputerInfo (#2995) 2017-01-23 13:07:38 -08:00
Naadir Jeewa 01dfb88e4d Initial Support for Fedora 24 (#2738)
* Initial support for Fedora 24
This commit adds initial support for the Fedora distribution,
starting with Fedora 24.

Whereever possible, build tooling for CentOS has been reused.

Until the next release of PowerShell is compiled against .NET 1.1,
the Docker release image uses the CentOS 7 build, but loads
in the CentOS 7 version of `libicu50` via LD_LIBRARY_PATH.

* Update Dockerfile

Fix typos
2017-01-20 11:05:24 -08:00
Jason Shirk c3588c936e Use (n) for offline file length formatting (#2986) 2017-01-17 13:00:19 -08:00
Jason Shirk 7cd5935595 Use correct win32 console mode w/ external commands (#2991)
At startup, we need to save the current console mode before potentially
enabling VT100 support.

Then, when running an external command, we should use that initial
console mode instead of whatever mode we changed it to.

An application can't rely on the shell enabling VT100 because enabling
by default can cause problems for some applications, therefore
Windows applications must enable VT100 themselves.
2017-01-17 12:56:23 -08:00
Ilya 9b23e1e1fe Fix error handling in parsing 'using' statement (#3007) 2017-01-17 12:54:43 -08:00
Jason Shirk 02b5f357a2 Remove trailing whitespace (#3001) 2017-01-16 13:31:14 -08:00
Mike Richmond 4eb1494442 Revert "Initial Support for Fedora 24" (#2970) 2017-01-06 13:09:40 -08:00
Naadir Jeewa 8262091b3a Initial Support for Fedora 24 (#2738)
* Initial support for Fedora 24
This commit adds initial support for the Fedora distribution,
starting with Fedora 24.

Whereever possible, build tooling for CentOS has been reused.

Until the next release of PowerShell is compiled against .NET 1.1,
the Docker release image uses the CentOS 7 build, but loads
in the CentOS 7 version of `libicu50` via LD_LIBRARY_PATH.

* Update Dockerfile

Fix typos
2017-01-06 10:04:18 -08:00
Francisco Gamino 66691a1c0c Adding PlatformNotSupportedException to Counter cmdlets when running on IoT. (#2952)
* Adding PlatformNotSupportedException to *-Counter cmdlets for IoT as pdh.dll is not available.
* Adding tests to validate PlatformNotSupportedException for the Counter cmdlets on IoT.
2017-01-05 16:59:31 -08:00
David Christian 062e15def2 Add parameter -Group to Get-Verb (#2789) 2017-01-03 15:13:42 -08:00
Faheel Ahmad d8b4200f6f Display PM and WS in MB instead of KB (#2927)
Modify output of Get-Process to display PM and WS in MB instead of KB.

Also change precision of CPU time to 2.
2016-12-29 10:49:15 -08:00
Lee303 78aa9a5b56 fix typo in comment (#2938) 2016-12-29 10:46:52 -08:00
Christopher Nelson 7388ec960f build: Update build.sh to run fully manual build (#2832)
* build: Update build.sh to run fully manual build
* add ubuntu-16.10-x64 to the list of architectures to build for.w
2016-12-28 13:59:51 -08:00
Ilya 8daef18769 Fix here string '$a=@"n'"'n"@' (#2913)
The tokenizer did multiple scans the script line to get tokens. Before
the fix the tokenizer on the first pass examined that string as
double-quoted (Expandable) string not as here string, figured the
average double quotation mark as a closing and then starting with the
single quotation mark continued processing the line as single-quoted
string which had no closing single quotation mark.
The fix is to stop the first scan pass after getting '=' (assume
assignment-expression '$a=' for next pass).
2016-12-23 09:34:09 -08:00
Keith Hill cd743cc7b0 Add support for escape char ESC via `e. (#2920)
This change is a breaking change but falls into compat bucket #3 - unlikely grey area.
2016-12-23 09:00:37 -08:00
Charu Bassi 821c965aee Fix type completion w/ type aliases (accelerators) (#2533)
Type completion would behave strangely when there were multiple aliases for a given type (currently only possible with type accelerators).

The fix is to only select the accelerator that matches what the user typed.

Closes #2295
2016-12-21 15:33:05 -08:00
Max Maximov 8be31098b1 Invoke-RestMethod cmdlet error if the response is neither JSON nor XML (#2862)
* This change fixes the Invoke-RestMethod cmdlet behavior if the input is neither xml nor json.
* test description
* fixed the failed tests
* removed some duplication
* refactoring: eliminated some double castings
* added JsonObject unit tests; enhanced JSON deserialization exception message
* refactored JsonObject.Tests.ps1
* entitled test cases
* formatting
2016-12-15 00:06:26 -08:00
Jeff Bienstadt da04f2b1a8 Implement performance-counter cmdlets for Windows CoreCLR
Code changes per PR code review - 3
2016-12-13 11:00:22 -08:00
Dongbo Wang bbf1766ac7 Fix try/catch to choose the more specific exception handler (#2429)
* Refactor 'FindMatchingHandler' to get rid of recursion
Search state can be saved and used throughout the searching process without the recursion.

* Rank the exception types based on how specific they are

* Refactor code to find handler based on the rank of given handlers
2016-12-09 12:37:08 -08:00
Dongbo Wang c982f30d4e Fix powershell class to use the current EngineSessionState for execution. (#2837)
When a PS class is defined in a module and the module gets reloaded, the class would still use the SessionState from the old module for execution, and thus it doesn't reflect changes to the module state during the reload. This fix is to make sure we always use the current EngineSessionState for PS class execution.
2016-12-09 11:06:07 -08:00
Dave Wyatt 177c99de93 Adding ValidateNotNullOrEmpty attribute to parameters listed in #2672 (#2685) 2016-12-08 10:28:55 -08:00
Naadir Jeewa 32a8601f92 Rebase onto .NET Core 1.1 (#2737)
* Rebase onto .NET Core 1.1

Modify `Build.psm1` and `project.json` files to use .NET Core 1.1.

.NET Core 1.1 ships with an older dotnet/cli than has currently been used,
so we revert to use case-sensitive directory names for dependencies.

.NET Core 1.1 is a pre-requisite for supporting Fedora 24.

* PSReadLine: Bump major version of PSReadline to 6.0.0-*

* Microsoft.PowerShell.Commands.Utility: Bump major version of Microsoft.CodeAnalysis.Csharp

* Microsoft.PowerShell.SDK: Revert attempt to import netcoreapp1.1 instead of dnxcore

* build.psm1: Restore ability to specify version of dotnet-install.sh
2016-12-07 18:29:21 -08:00
Kitt Holland e568fda5c3 Rewrite New-TemporaryFile in C# (#2786)
Literal translation of New-TemporaryFile function to a C# cmdlet,
other than moving logic from Begin to End.
2016-12-06 16:22:07 -08:00
Dongbo Wang ecfab1d550 Depend on the NuGet package 'libpsrpclient' to enable client-side PSRP on Linux and OSX 2016-12-06 11:33:07 -08:00
David Christian 9c9b56d22f Updated Split-Path to work with UNC Roots (#2788) 2016-12-04 15:00:32 -08:00
iSazonov 8abb6c3a94 Implicitly convert value assigned to XML property to string (#2678)
Using LanguagePrimitives.ConvertTo (to emulate what would happen if the property were a regular .Net property typed as string), we now convert the value assigned to an XML property to string.
2016-12-02 15:43:10 -08:00
Paul Higinbotham d2bf6294ab SSH remoting cmdlet parameter set changes based on RFC 0010 (#2710)
* RFC 0010 SSH remoting cmdlet updates.

* Tweaks to SSH remoting cmdlets

* SSHTransport parameter is now optional instead of mandatory.  Aded fix for CoreCLR entry point when hosted in SSH as a subsystem.

* Added tests

* Code review feedback

* Code review comment changes

* Making SSHTransport switch parameter mandatory because otherwise existing Invoke-Command parameter set

* The new SSH parameter set was causing legacy positional based parameters to no longer work. This fix separates the SSH parameter sets from the existing WinRM parameter sets.

* Fixed region name spelling error.
2016-12-02 14:01:08 -08:00
Jason Shirk 19a0d993e7 Remove one more extra Expression.Block call (#2833) 2016-12-02 13:23:09 -08:00
Jonathan Malek 77c622eeea Wrapping a call to Registry so that Invoke-WebRequest does not fail on non-text responses (#2811)
* Wrapping a call to Registry with a check for Platform.IsWindows
2016-12-02 11:38:38 -08:00
Jason Shirk (POWERSHELL) 0cd1a0ff48 Remove unneeded blocks 2016-12-01 13:46:56 -08:00
Jason Shirk (POWERSHELL) 386b4f37f4 Remove CheckForSevereException and private FailFast
Our private implementation of FailFast was likely introduced
when each individual application needed it's own code to
get Watson reports. The CLR takes care of this for us now,
so we don't need our implementation.

Our method CheckForSevereException was also introduced in
the early days of the CLR - the exceptions it was checking
for aren't actually raised the CLR anymore, they just FailFast.
I removed them as there is a tiny bit of overhead (in code size)
and also in the generated code, e.g. dynamic sites called the method.
2016-12-01 13:46:56 -08:00
Staffan Gustafsson 5484b98a7a Moving New-Guid to compiled cmdlet (#2752) 2016-12-01 11:36:42 -08:00
Dongbo Wang 62af9b792f Revert the timer change introduced in #2640 because it causes race conditions 2016-11-30 13:02:32 -08:00
iSazonov d543195bd4 Fix Verbs<> class strings #2716 (#2762)
* Fix Verbs
* Replace `-runspace` with `-Session`
2016-11-23 09:19:15 -08:00
Mike Richmond cac96e5fc9 Fixing powershell.exe lib paths and more thoroughly cleaning the powershell-native directory (#2758) 2016-11-21 16:55:03 -08:00
Dongbo Wang 20a0ba041c Fix the indicator for redirecting standard input (#2749) 2016-11-21 16:02:52 -08:00
Jianyun Tao 1fff6760b6 Removed PowerShellGet source and replaced with ones from myget 2016-11-19 23:52:16 -08:00
Jianyun Tao c86d469c26 remove PackageManagement source code 2016-11-19 23:52:16 -08:00
Jianyun Tao b6a3eb10c7 update project.json 2016-11-19 23:52:16 -08:00
Mike Richmond 71da6b6e26 Add x86 support to the remoting install script 2016-11-18 16:35:16 -08:00
Mike Richmond e23b0b2002 Add runtime win7-x86 2016-11-18 16:35:16 -08:00
Mike Richmond 81b2339979 Add support to build x86 packages for PowerShell Core 2016-11-18 16:35:16 -08:00
Oisin Grehan e37df9da62 Guard against ReflectionTypeLoadException in InitializeTypeCache (#2549) 2016-11-18 14:36:26 -08:00
iSazonov 4edde10fda Now Enum values definition have space-insensitive syntax (#2690)
Fix to support whitespace after the `=` and before the value expression.
2016-11-18 14:00:26 -08:00
iSazonov 469924d855 Add support W3C Extended Log File Format in Import-Csv (#2482)
* Add support W3C Extended Log File Format

1. Add support W3C Extended Log File Format
2. Refactoring Import-Csv tests

3. Add #Type tests

* Fx test after review

* Fix tests after review

* Remove unneeded test
2016-11-17 16:29:04 -08:00
Sergei Vorobev 3363b248a0 Fix code errors found by PVS-Studio (#2695)
* Fix errors found by PSV-studio analyzer

http://www.viva64.com/en/b/0447/

* Remove old redundent comment

errorAsts is passed by ref
2016-11-17 11:20:04 -08:00
Alessandro Pilotti 15ed125c4a Fixes deprecated syscall issue on macOS 10.12 (#2633) (#2675)
syscall() has been deprecated and is not available on macOS 10.12.
2016-11-16 16:26:46 -08:00