Skip to content

Implement Invoke-Item for .NET Core on Windows, Nano Server and IoT #2272

@Francisco-Gamino

Description

@Francisco-Gamino

Steps to reproduce

To fix this issue, a possible solution is to wrap the call in cmd.exe “start...”; however, in order to figure out if the process fail to start, we need WaitForExit, then check the exit code, and extract the standard error. This is a change on behavior between Full and CoreCLR PowerShell. The problem with this implementation is that PowerShell will be blocked until the process completes. Alternatively, if we decide to just ignore the error, then this behavior will also be incorrect since in PowerShell no error means the operation was successful.
We should explore doing a PInvoke in Windows CoreCLR. This way, we can get the Marshal.GetLastWin32Error() if we fail to start the process.

on Windows Core CLR
invoke-item path_to_file_or_exe

Expected behavior

Actual behavior

Environment data

> $PSVersionTable

Metadata

Metadata

Assignees

Labels

Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-FixedThe issue is fixed.WG-Cmdletsgeneral cmdlet issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions