IlanCosman/tide

status item not reporting $status properly with `not`

PatrickF1 opened this issue · 1 comments

Describe the bug

The prompt item status does not properly represent the $status of the previous command executed.

Steps to reproduce

  1. execute not false
  2. observe status comes ✘ 1
  3. echo $status
  4. observe it was 0

It seems that it's not taking account the not because if you just type in false or true normally, it works as expected.

Thank you for maintaining Tide and reading my bug report!

This is actually quite complex unfortunately. I'll have to do some digging and thinking about how to best deal with this.

Here's a sneak peek of the complexity which arises due to piping, and how $pipestatus and $status interact with it:

ilan@arch ~> not true | true
ilan@arch ~ [0|0] 1> printf %s\n "status: $status" "pipestatus: $pipestatus"
status: 1
pipestatus: 0 0
ilan@arch ~> true | not false
ilan@arch ~> printf %s\n "status: $status" "pipestatus: $pipestatus"
status: 0
pipestatus: 0 1
ilan@arch ~> false | not true
ilan@arch ~ [1|0] 1> printf %s\n "status: $status" "pipestatus: $pipestatus"
status: 1
pipestatus: 1 0