Skip to content

Out-Default function breaks $? #31

@chenxiaolong

Description

@chenxiaolong

The definition of Out-Default seems to be breaking the usage of $?.

For example, if I run an invalid command in pwsh -noprofile, I get this:

PS C:\Users\chenxiaolong> git asdf
git: 'asdf' is not a git command. See 'git --help'.

The most similar command is
        add
PS C:\Users\chenxiaolong> echo $?
False

If I import Get-ChildItemColor (version 2.1.1), then $? stops working properly:

PS C:\Users\chenxiaolong> Import-Module Get-ChildItemColor
PS C:\Users\chenxiaolong> git asdf
git: 'asdf' is not a git command. See 'git --help'.

The most similar command is
        add
PS C:\Users\chenxiaolong> echo $?
True

If I remove the Out-Default function, then things work again, but of course, no more ls colors:

PS C:\Users\chenxiaolong> Remove-Item Function:Out-Default
PS C:\Users\chenxiaolong> git asdf
git: 'asdf' is not a git command. See 'git --help'.

The most similar command is
        add
PS C:\Users\chenxiaolong> echo $?
False

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions