starship: Prompt hangs and uses high CPU usage

Current Behavior

When running starship prompt, it hangs and leads to high CPU usage.

Expected Behavior

It should show the prompt and not use high amounts of CPU.

Additional context/Screenshots

Possible Solution

Environment

  • Starship version: 1.10.0
  • bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu) Copyright © 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

  • Operating system: Ubuntu 20.04
  • Terminal emulator: vscode 1.70.1
  • Git Commit Hash:
  • Branch/Tag: master
  • Rust Version: rustc 1.63.0 (4b91a6ea7 2022-08-08)
  • Rust channel: release
  • Build Time: 2022-08-14 20:13:29 +00:00

Relevant Shell Configuration

eval "$(starship init bash)"

nightly() {
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly
}

Starship Configuration

[time]
disabled = false
format = '[\[ $time \]]($style) '
time_format = "%T"

[nodejs]
disabled = true

[git_status]
disabled = true

[cmd_duration]
min_time = 500
format = "took [$duration](bold yellow)"

[battery]
disabled = true

[git_metrics]
disabled = false

[lua]
disabled = true

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

@davidkna I managed to reproduce the issue with a minimal example after all and created https://github.com/rayon-rs/rayon/issues/967 in response.

export STARSHIP_NUM_THREADS=6 does seem to fix it.

It looks like I can trigger it by setting STARSHIP_NUM_THREADS=1.

I can reproduce this with an empty git repo.

Step to reproduce

  1. mkdir foo
  2. cd foo
  3. git init
  4. starship hang at there

Environment

  • Starship version: 1.10.0
  • zsh version: zsh 5.8.1 (x86_64-ubuntu-linux-gnu)
  • Operating system: Ubuntu 22.04
  • Terminal emulator: <unknown terminal> <unknown version>
  • Git Commit Hash:
  • Branch/Tag: master
  • Rust Version: rustc 1.63.0 (4b91a6ea7 2022-08-08)
  • Rust channel: release
  • Build Time: 2022-08-14 20:13:13 +00:00

Starship Configuration

"$schema" = 'https://starship.rs/config-schema.json'

[status]
disabled = false
format = '[$symbol$status_common_meaning$status_signal_name$status]($style) '
map_symbol = true
pipestatus = true

[git_metrics]
disabled = false

[sudo]
disabled = false

A PR for starship was submitted which fixes this issue.

I will link the respective jwalk issue here once I can reproduce it there with a minimal example.