9

When I try to navigate directories using the cd command, it takes way too a long time. And terminal suggests creating a config file to increase the timeout. Once my terminal hanged, I mean when I tried to execute the command, the cursor kept blinking but nothing was happening and even ctrl+c had no effect I had to reboot. But the slow terminal still persists. I have observed that this delay problem occurs only for the cd command.

~ on ☁️  (us-east-2) 
❯ cd Cloud/
[WARN] - (starship::utils): Executing command "/usr/bin/git" timed out.
[WARN] - (starship::utils): You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing.

Cloud on  main on ☁️ (us-east-2) ❯

4 Answers4

6

The message was clear, you just needed to set a timeout:

Inside ~/.config/starship.toml (create it if it doesn't exist) you could set the timeout like this:

command_timeout = 10000

And then update or reinstalling the starship:

sh -c "$(curl -fsSL https://starship.rs/install.sh)"
void
  • 191
6

I had the same problem. Using this command, starship config command_timeout 1000, helped me fix it.

Source: https://github.com/starship/starship/discussions/4181#discussioncomment-3170845

1

Starship executes different commands to get information to display in the prompt, for example the version of a program or the current git status. To make sure starship doesn't hang while trying to execute these commands we set a time limit, if a command takes longer than this limit starship will stop the execution of the command and output the above warning, this is expected behaviour.

This time limit is configurable using the command_timeout key; you can increase the time limit. You can also follow the debugging steps below to see which command is being slow and see if you can optimise it. Finally you can set the STARSHIP_LOG env var to error to hide these warnings.

This issue happens in really big git repos, if the repository is too big, you cannot afford the timeout, you can skip the warnings with:

In your ~/.config/starship.toml:

# Set whatever time out in ms.
command_timeout = 500

In your ~/.zshrc:

# Launch Starship theme
export STARSHIP_LOG="error"
eval "$(starship init zsh)"
avpaderno
  • 297
0

I'm on a mac and I fixed this by reinstalling xcode with homebrew. I ran the command

brew install xcode

and it fixed my issue.

LoganN
  • 1