Commit Graph
56 Commits
Author SHA1 Message Date
Ilya 598cebf7b2 Add cache for GetApplicationBase (#3969) 2017-06-20 15:08:02 -07:00
Paul Higinbotham 578f9e5e8b Fix Linux platform SSH process creation for remoting (#3901)
* Fix SSH process creation on Linux platforms

* Fixed typos

* Added UNIX managed code StartProcess

* Fixed compile errors

* Changed process create to return pid

* Now resolve full SSH command file path for all platforms

* Removed data reader error handling because it conflicts with SSH errors in the error stream

* Clean up work

* Fix for file line endings

* More clean up

* Change to Linux platform SSH process creation to create process in new session

* Added third party license text for DotNet Core

* Removed process creation in new session and added suppress SIGINT

* Removed unneeded code for creating SSH process

* Fixed Unix compile errors

* Changes for code review

* Response to more code review comments

* Removed unneeded using statements
2017-06-14 15:56:56 -07:00
jeffbi ce4c35b9ed Allow use of long paths (#3960)
When calling Windows native API to determine if an item exists,
ensure the path is prepended with "\\?\" when the path is a long path.

Fixes #3891
2017-06-07 17:13:51 -07:00
Dongbo Wang 8ae6c5bb3b Refactor PowerShell Core to use the default CoreCLR loader instead (#3903)
Remove the code that spins up our own assembly load context. Keep the code that registers our `Resolve` method to the default loader's `Resolving` event, so that we can continue to do special assembly resolution as needed (such as the GAC probing logic needed for consuming FullCLR PS modules).

Essentially, the assembly `Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll` is not needed anymore, the remaining code should be moved to S.M.A.dll. However, that will break DSC and other native hosts that are hosting powershell. So this assembly is kept for now.
2017-06-05 20:59:30 -07:00
jeffbi c29bd7d684 Make Get-ChildItem continue enumeration when encountering error on contained item (#3806)
Added try/catch within the enumeration loop to allow the enumeration to continue after encountering an error such as an item within the directory being deleted or renamed.

To assist in testing, two new internal test hooks have been added which cause Get-ChildItem to either delete or rename a specific file (file name hard-coded) when encountered during enumeration.
2017-05-25 17:24:47 -07:00
Ilya 6db5c945b2 Remove unused and duplicated GetEncodingFromEnum (#3487) 2017-04-21 18:07:54 -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
Dongbo Wang 7f83c48ca5 Add support to ShellExecute in powershell core when it's running on Windows full SKUs (#3281)
* Add ShellExecute support to PowerShell core on windows full desktop
* Add tests for Start-Process and update existing related tests
2017-03-14 11:11:41 -07:00
jeffbi 97be759cc7 Do not reject Windows' reserved device names on non-Windows platforms. (#3252) 2017-03-07 10:29:20 -08:00
Jason Shirk 02b5f357a2 Remove trailing whitespace (#3001) 2017-01-16 13:31:14 -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
iSazonov b56bbeabc6 Add Get-Uptime to Microsoft.PowerShell.Utility (C# cmdlet) (#2517)
* Add Get-Uptime (C# code)

1. Add Get-Uptime cmdlet (C# code)
2. Modify psd1 files
3. Add tests

* Remove Pretty parameter after Powershell committee conclusion

1. Remove Pretty parameter
2. Remove tests for Pretty
3. Add Throw if  IsHighResolution is False
4. Fix formatting

* Add test to check throw

1. Add hook that simulate 'System.Diagnostics.Stopwatch.IsHighResolution == false' to test Get-Uptime throw
2. Add test to check throw

* Fixes after review

1. Remove Timespan parameter
2. Remove unneeded tests
3. Fix localization
4. Add string consts
5. Fix throw

* Fix OutputType to add parameter set name information
2016-11-10 09:51:29 -08:00
Dongbo Wang d0c60e049d Avoid calling static members from 'Microsoft.Win32.Registry' on UNIX, especially the code that would run in TypeInitializer.
This is because with the latest .NET Core packages (1.1.0 preview), calling static members from 'Microsoft.Win32.Registry' will raise 'PlatformNotSupportedException'.
2016-10-14 10:02:44 -07:00
Francisco Gamino d717458e7d Fixing get-help <cmdletName> -online for .NET Core on Desktop. (#2174)
In PS Core on windows, we try to locate the default web browser and use it for online help. If we cannot find the default web browser (in NanoServer/IoT), we error out.
2016-10-12 12:16:32 -07:00
Charu Bassi 5cbf1b43de Fix 'Get-ChildItem -Hidden' to work on system hidden files like c:\hiberfil.sys c:\pagefile.sys and c:\swapfile.sys 2016-09-27 16:13:03 -07:00
Josh Soref c59e992c25 spelling: comments in src/System.Management.Automation/engine 2016-08-28 05:44:55 +00:00
Mike Richmond 18f3589d68 Fixing the path to the user's JSON configuration file 2016-08-23 15:45:49 -07:00
Dongbo Wang ea9694980e Address review comments in product code 2016-08-12 11:01:23 -07:00
Dongbo Wang 3ff19e1d80 Update module path calculation logic to support side-by-side.
Use 'Path.PathSeparator' instead of ';' to separate paths, so that it uses ';' on windows and ':' on unix.
Also refactor some code as part of the change.
2016-08-11 21:36:48 -07:00
Mike Richmond 33c1f2db23 Fixing execution policy so test automation works 2016-08-04 13:15:34 -07:00
Mike Richmond f8b9b88986 Bug fixes and cleanup in preparation for push. 2016-08-04 13:15:34 -07:00
Mike Richmond 73689d697a ExecutionPolicy is now working from JSON files 2016-08-04 13:15:34 -07:00
Jason Shirk f15e66b283 Merge pull request #1633 from PowerShell/revert_psedition_namechange
Revert the changes made in #1457. Desktop and Core are the PowerShell Edition names. Remove Linux as edition name.
2016-08-04 12:21:12 -07:00
Manikyam Bavandla eacfd9418c Revert "Merge pull request #1458 from PowerShell/psedition_rename"
This reverts commit 042d1e99bb, reversing
changes made to 105bf9c9ff.
2016-08-03 15:53:31 -07:00
PowerShell Team 85d6e9f022 Refactoring - adjust modifiers declaration order 2016-08-03 12:14:28 -07:00
PowerShell Team bc4901bd59 Remove unused using statements 2016-08-03 12:06:06 -07:00
PowerShell Team 403ae3f53f Initial run of code formatter
I (Jason Shirk) ran https://github.com/dotnet/codeformatter with the default rules, basically:

    codeformatter /nocopyright "/c:DEBUG,UNIX,CORECLR" @files.rsp

This caused a few problems building, which were fixed up manually.

Notable changes:

`this.` is removed unless needed to disambiguate.
private instance fields are renamed to have a `_` prefix.
private static fields are renamed to have a `s_` prefix.

I left some projects alone (like PackageManagement) and also left some generated code alone.
2016-08-01 15:57:03 -07:00
Andrew Schwartzmeyer f0e64c2c6c Clean up ApplicationBase work-around 2016-07-26 11:49:54 -07:00
Andrew Schwartzmeyer d40131ae44 Clean up PSMODULEPATH Windows work-around 2016-07-26 11:49:54 -07:00
Jason Shirk (POWERSHELL) 673dd2c355 Change preprocessor macro LINUX to UNIX 2016-07-22 10:49:45 -07:00
Manikyam Bavandla 81e5a7e7aa Update PSEdition values to Rename Desktop & Core to WindowsPowerShell and PowerShellCore
$PSVersionTable.PSEdition currently supports Desktop and Core enums.
Because PowerShell is going to be Open and also available on Linux/Mac
from August, we decided to rename these values so as to make it clear to
the end user.
We decided to use the names WindowsPowerShell,PowerShellCore.
2016-07-20 18:30:21 -07:00
Andrew Schwartzmeyer ad94ddb3f1 Guard IsWinPEHost 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 89508ae99d Revert IsWinPEHost changes 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 662e390902 Remove Platform.HasGroupPolicySupport query 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 2249afcd0a Remove Platform.HasUNCSupport query 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 73a1a51f69 Remove Platform.HasRegistry query 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 5ef851a170 Port NativeItemExists for Linux
Without using .NET
2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer 3dacf45789 Revert NativeItemExists changes from baseline 2016-07-14 17:34:12 -07:00
Andrew Schwartzmeyer c17244eed2 Fix IsAdministrator for Unix 2016-07-13 15:46:25 -07:00
quoctruong91 35ac5999ac Rename enum interface; Change location used in NuGetProvider to go up 1 level 2016-07-06 10:28:31 -07:00
Andrew Schwartzmeyer 2f892e8127 Use Marshal.ZeroFreeCoTaskMemUnicode
This removes the ClrFacade function of the same name as this API is in
.NET Core 1.0 Marhsal class, not SecureStringMarshal.
2016-06-27 15:30:47 -07:00
Andrew Schwartzmeyer 97df59f553 Re-enable checking of assemblies with strong names
This removes the `UsesCodeSignedAssemblies()` switch in `CorePsPlatform`
and reverts the work-arounds skipping strong name checking.
2016-06-27 14:49:46 -07:00
PowerShell Team 8ee6d6ca43 Update files from Source Depot changeset [SD:715912]
Corresponds to 77eda782aa78ba8b7a36c51ee619629ce6c990f2 in psl-monad.
2016-06-15 18:02:03 -07:00
Andrew Schwartzmeyer 0e10a51802 Whitespace and formatting cleanups 2016-06-09 09:50:36 -07:00
v-alexjo 29e97bf1aa Code review changes to XDG support 2016-06-09 09:50:36 -07:00
v-alexjo 54c64c9db6 Initial XDG support and folder default changes
Conflicts:
	src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs
2016-06-09 09:50:36 -07:00
PowerShell Team b38773eb79 Update files from Source Depot changeset [SD:709766]
Corresponds to 15b1623435d6a195d1e877ba5c43709d991f573a in psl-monad.
2016-05-31 14:12:49 -07:00
Andrew Schwartzmeyer a4ef2b7e8b Add PSReadLine as base module
Note that, because Linux file systems are case-sensitive, we have to
use the correct capitalization that matches the actual module files.
2016-04-27 13:40:27 -07:00
Andrew Schwartzmeyer 49066d212a Replace IsX method with IsCore property 2016-04-08 15:04:16 -07:00
Andrew Schwartzmeyer f5410a18ce Replace IsWindows method with property
And add *correct* IsLinux and IsOSX properties.
2016-04-08 14:54:41 -07:00