JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.02k stars 2.37k forks source link

Check if "ctrl + c" / aborted / terminated #2523

Closed WalterWoshid closed 2 years ago

WalterWoshid commented 2 years ago

Code of Conduct

What would you like to see changed/added?

Is there a way to check if the program has been terminated and change the default behaviour which is the red "^C"?

JanDeDobbeleer commented 2 years ago

@WalterWoshid that's already possible as that results in error code 130 which you use in a template:

"{{ if eq .Code 130 }}SIGINT{{ else if gt .Code 0 }}\uf00d {{ .Meaning }}{{ else }}\uf42e{{ end }}"
WalterWoshid commented 2 years ago

@JanDeDobbeleer This does not work. I get error code 0. I am using Windows Terminal with a powershell instance.

This is my segment:

{
  "template": "{{ if eq .Code 130 }}NICE | {{ end }}Real Code: {{ .Code }} ",
  "style": "powerline",
  "type": "text"
},
JanDeDobbeleer commented 2 years ago

@WalterWoshid seems like on Windows this doesn't return an exit code. It does on macOS, so I the logic is correct, it just behaves differently. That's a bug for PowerShell.

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.