Skip to content

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

Closed

Description

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

Activity

  1. added
    Issue-BugIssue has been identified as a bug in the product
    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
    and removed
    Issue-BugIssue has been identified as a bug in the product
    on Sep 19, 2016
  2. adityapatwardhan commented on Sep 19, 2016

    @adityapatwardhan
    Member

    Francisco Gamino (@Francisco-Gamino). Please add the PSVersionTable information.

  3. daxian-dbw commented on Oct 12, 2016

    @daxian-dbw
    Member

    This issue covers the Invoke-Item part of the original issue #1325

  4. added this to the milestone on Nov 4, 2016
  5. SteveL-MSFT commented on Nov 4, 2016

    @SteveL-MSFT
    Member

    This also needs to work on Linux so don't have just a Windows solution

  6. modified the milestones: , on Dec 19, 2016
  7. daxian-dbw commented on Mar 15, 2017

    @daxian-dbw
    Member

    Invoke-Item already works on Linux and Mac. On windows, Invoke-Item was enabled by adding support to ShellExecuteEx in powershell core via #3281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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