PSColor icon indicating copy to clipboard operation
PSColor copied to clipboard

PSColor eats the last error code

Open erichiller opened this issue 4 years ago • 2 comments

ie.


> Do-SomeInvalidCommand
# some error about Do-SomeInvalidCommand not being a real command
> $?
True

while ( $True -eq $True ) {
    Start-Sleep 1;
    echo "loop";
}
# Hit Ctrl+C
> $?
True

Both of these should have resulted in $? being False, as they are without PSColor imported.

I disabled all other modules for testing it was certainly PSColor which was absorbing the last error code.

erichiller avatar May 05 '20 13:05 erichiller

I upvote this issue. I sadly had to disable the module in order to have an accurate behavior in my shell.

Expected behavior (without the PSColor module)

PS > python -c "exit(1)"
PS > echo $?
False

Actual behavior (with the PSColor module)

PS > python -c "exit(1)"
PS > echo $?
True

vdsbenoit avatar Nov 23 '21 10:11 vdsbenoit

FYI, @joonro fixed it in his project :

https://github.com/joonro/Get-ChildItemColor/commit/d651f922462d98934c1beff565c931bbbb80d39e

https://github.com/joonro/Get-ChildItemColor/issues/31

vdsbenoit avatar Jun 29 '22 15:06 vdsbenoit