PSColor
PSColor copied to clipboard
PSColor eats the last error code
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.
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
FYI, @joonro fixed it in his project :
https://github.com/joonro/Get-ChildItemColor/commit/d651f922462d98934c1beff565c931bbbb80d39e
https://github.com/joonro/Get-ChildItemColor/issues/31