lf: High cpu usage in background

I often open a child shell in the current directory (by pressing w) and lf keeps running as a parent process. I’ve been using this for years, since I switched to lf and never had any problems.

Recently (I think it started happening after updating to r21), I started noticing that lf often uses 100% of CPU. I can’t reproduce what exactly makes it run like this, but it does happen multiple times a day.

Any tips on how to avoid this?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 17 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@ecomaikgolf I have tried this with previous versions. It seems that signal is skipped in zsh with previous versions as well. But we were using Init function to resume ui before and we simply exit when it fails to initialize the screen. In r21, we switched to Suspend/Resume and I forgot to add error handling for these functions. Now we also exit when Resume fails so the issue should be fixed with the latest commit.

I have now released r22 which includes the fix. Closing this issue.

Same issue here. lf r21, archlinux, dwm, st, zsh image

I usually open lf with the following zshrc funcion

lfcd () {
    tmp="$(mktemp)"
    lf -last-dir-path="$tmp" "$@"
    if [ -f "$tmp" ]; then
        dir="$(cat "$tmp")"
        rm -f "$tmp"
        [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
    fi
}
bindkey -s '^o' 'lfcd\n'

Never had any problems with it until now

How to reproduce

  • Open terminal
  • Press Ctrl+O (executes the function)
  • Go to some dir
  • Press w to open a shell
  • Close the terminal (kill it with xkill for example)

The issue isn’t disappeared Screen

macOS, lf version r21