Skip to content

Background operator (&) seems to have dependency on Windows PS #11257

Closed

Description

The new implicit remoting to WinPS in preview6 brings this to light.

Steps to reproduce

git push &

Expected behavior

Creates background job using Start-Job and returns job object.

Actual behavior

There is warning, which tells me that for some of its work, Windows PowerShell is involved, I though it was just Start-Job with no dependency on WPS
image

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. added
    Issue-Question
    on Dec 3, 2019
  2. changed the title [-]Background operator (&) seems to have dependency on Windows PS starting with 7.0-preview6[/-] [+]Background operator (&) seems to have dependency on Windows PS[/+] on Dec 3, 2019
  3. jhoneill commented on Dec 4, 2019

    @jhoneill

    I had the same message in VS code for no obvious reason this afternoon. And on my home pc
    cmd /c dir &
    gets the result above
    I tried breaking the psscheduledJob module (take ownership and assign full control, and rename the psd1 file).
    cmd /c dir & still works, but the module is not loaded and the message doesn't appear. So I think this is something odd about that module, not the & operator.

  4. vexx32 commented on Dec 4, 2019

    @vexx32
    Collaborator

    /cc Paul Higinbotham (@PaulHigin)

    James O'Neill (@jhoneill) I'd try to repro without your profile loaded, as you may have some code in your profile that is triggering the attempted loading of the winPS module.

  5. added
    Issue-Bug
    and removed
    Issue-Question
    on Dec 4, 2019
  6. SteveL-MSFT commented on Dec 4, 2019

    @SteveL-MSFT
    Member

    This is already fixed via #11194

    This happens because when using a PSJob cmdlet, PowerShell will try to import modules that implement the JobAdapter. With the new WinPS code path, it imports ScheduledJob module since it implements JobAdapter. It does this because ScheduledJob (along with PSWorkFlow) support serialized jobs. This means that when you do Get-Job, it will find and show these jobs. But to be able to do that, it has to load those modules and get them to enumerate their jobs. Since ScheduledJob doesn't actually work with PowerShell 7 and PSWorkFlow is already not supported, the fix is to not automatically load these two modules.

  7. jhoneill commented on Dec 4, 2019

    @jhoneill

    /cc Paul Higinbotham (@PaulHigin)

    James O'Neill (@jhoneill) I'd try to repro without your profile loaded, as you may have some code in your profile that is triggering the attempted loading of the winPS module.

    Just tried that ... no change :-( It's possible that some of the other cases where modules autoload for reasons I can't see are caused by something in my profile. But it happens rarely and I haven't stopped what I've been doing to investigate, so I don't have any kind of pattern of "x will auto-load if I do Y". It sounds like Steve has explained what causes this module to load and there is already a fix in the works :-)

    Steve Lee (@SteveL-MSFT) so it still tries to load modules which implement the jobadapter but has a hard coded exception for one or two ?

  8. bergmeister commented on Dec 4, 2019

    @bergmeister
    ContributorAuthor

    Thanks, I can confirm, it is not happening any more with the daily build

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugResolution-Fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions