Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent exit code behavior #207

Closed
2 tasks done
meakbiyik opened this issue Dec 1, 2020 · 2 comments
Closed
2 tasks done

Inconsistent exit code behavior #207

meakbiyik opened this issue Dec 1, 2020 · 2 comments
Labels
🐛 bug Something isn't working powershell

Comments

@meakbiyik
Copy link

meakbiyik commented Dec 1, 2020

Prerequisites

  • I have read and understand the CONTRIBUTING guide
  • I looked for duplicate issues before submitting this one

Description

Hi all, first of all what a great work you are building. Makes me look at my terminal several times a day just to see how it looks like.

The problem is the inconsistent behavior of the exit codes: I am concurrently using the versions 2 and 3 of oh-my-posh right now because I am still deciding on the bits and pieces of the theme. After opening the terminal, running these sequences gives different outputs in both terminals, and the version 3 behavior seems rather buggy.

  1. I am an error
  2. git --help
  3. git --error
  4. git --help
  5. I am an error

In Powershell 5.1 / oh-my-posh v2, the resulting error sequence is this:

  1. error
  2. no error
  3. no error
  4. no error
  5. error

In Powershell 7 / oh-my-posh v3, however, it is like this:

  1. error
  2. no error
  3. error
  4. no error
  5. no error

The thing I am pretty sure about being a bug is the stage 5 of the latter experiment: see that "I am an error" returns a non-zero error code when run as a first command, but not after a zero return code git command.

Although I am not experienced with the inner workings of a shell, I can see that this is probably a Powershell 7 error rather than oh-my-posh3, but I guess it is worth noting it here in any case.

Environment

  • Oh my Posh version: 2 & 3
  • Theme: {2: "Operator"}, {3: jandedobbeleer}
  • Operating System: Windows
  • Shell: Powershell 5.1, Powershell 7
  • Terminal: Windows Terminal
@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Dec 2, 2020

Only 5 is an issue. V2 fails on 3, which should be an error. It's also a Powershell only issue as on zsh I do get the right behavior:

  1. error
  2. no error
  3. error
  4. no error
  5. error

EDIT: on Powershell 7 I also don't get an error on 1, so most likely 1 and 5 are the same issue (should be given the command).

@JanDeDobbeleer JanDeDobbeleer added 🐛 bug Something isn't working powershell labels Dec 2, 2020
@meakbiyik
Copy link
Author

How interesting, that we are getting that many different outputs. If it helps, here are my powershell versions:

pwsh 5:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  610

pwsh 7:

Major  Minor  Build  Revision
-----  -----  -----  --------
7      1      0      -1

Btw, the command on the errors for stage 1 and 5 were I am an error, letter by letter, if I caused any confusion with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working powershell
Projects
None yet
Development

No branches or pull requests

2 participants