Skip to content

Make Microsoft.PowerShell.Platform a system module #625

Closed

Description

I believe we should add the Microsoft.PowerShell.Platform to the built-in modules.

This would give us $IsWindows, $IsLinux, $IsOSX, and $IsCore as global variables for both full and core PowerShell. We are now programming against these in the Pester tests. This would also give us a set module to add further platform-specific PowerShell functionality (I'm surprised we haven't already done this).

Doing this would enable me to remove its import statement from the default profile, and from the CI scripts.

/cc sergei (@vors) James Truher (@JamesWTruher)

Activity

  1. andyleejordan commented on Mar 5, 2016

    @andyleejordan
    MemberAuthor

    This issue was sparked by #623.

  2. vors commented on Mar 7, 2016

    @vors
    Collaborator

    Just hit this problem

    image

  3. andyleejordan commented on Mar 7, 2016

    @andyleejordan
    MemberAuthor

    If we do not add the Platform module to the built-in modules, then we must always override the PSModulePath because it's being inherited from the environment on Windows, and does not contain our modules folder. I am for adding it as a built-in.

  4. andyleejordan commented on Mar 8, 2016

    @andyleejordan
    MemberAuthor

    Work-around for now is $env:PsModulePath="$pwd/bin/Modules".

    PowerShell Core always expects to have this path, but we'd still want to inherit a set PsModulePath. Would it be appropriate to check the path, and if this folder (the built-ins folder) is missing, add it?

  5. added
    Issue-BugIssue has been identified as a bug in the product
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    and removed
    Issue-Enhancementthe issue is more of a feature request than a bug
    on Mar 8, 2016
  6. JamesWTruher commented on Mar 8, 2016

    @JamesWTruher
    Collaborator

    hmmmm - this is only true if you're in the PowerShell directory (where build.sh is) - also, is there any case sensitivity about the environment variable? An alternative approach is to put
    export PSMODULEPATH=$HOME/PowerShell/bin/Modules
    in your BASH profile

  7. andyleejordan commented on Mar 8, 2016

    @andyleejordan
    MemberAuthor

    James Truher (@JamesWTruher) This is not an issue on Linux, this is an issue on Windows.

  8. andyleejordan commented on Mar 9, 2016

    @andyleejordan
    MemberAuthor

    Paul Allen (@paulcallen) Hit this too with remoting tests. The platform module must become a built-in for things to work "as expected" with cross-platform PowerShell script development.

    I'll get on this.

  9. andyleejordan commented on Mar 11, 2016

    @andyleejordan
    MemberAuthor

    Resolved this in #646.

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

Metadata

Metadata

Labels

Issue-BugIssue has been identified as a bug in the productIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aOS-LinuxOS-Windows

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions