jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.82k stars 1.85k forks source link

Process suspended after shell command execution #3903

Open abobov opened 1 month ago

abobov commented 1 month ago

Describe the bug

When shell command executed with : hotkey lazygit process become suspended.

To Reproduce Steps to reproduce the behavior:

  1. Open lazygit
  2. Type : to enter shell command menu
  3. Type any command, ex.: date
  4. Command output displayed and lazygit process suspended, your shell is open.

Expected behavior

Lazygit ask to press any key and after return to lazygit.

Screenshots

demo.webm

Version info: Run lazygit --version and paste the result here

commit=2d0c7cb0fc85e3c262837eb9691813fa97e00e80, build date=2024-09-07T02:26:26Z, build source=binaryRelease, version=0.44.0, os=linux, arch=amd64, git version=2.39.2

Run git --version and paste the result here

git version 2.39.2

Additional context

Problem appears with version 0.44.0 and master.

abobov commented 1 month ago

Reverting https://github.com/jesseduffield/lazygit/pull/3793 on master fix my issue. Maybe it is expected behavior now?

stefanhaller commented 1 month ago

No, it's not the expected behavior, and it doesn't happen for me.

I can't explain why this happens to you, but I suspect it has something to do with what's in your .zshrc (or maybe .zprofile). Could you post those?

abobov commented 1 month ago

It is not related to my zsh config. I also tested it on debian:latest docker image with default bash:

docker run -it debian:latest

# In container shell
apt update && apt install -y git wget
wget https://github.com/jesseduffield/lazygit/releases/download/v0.44.0/lazygit_0.44.0_Linux_x86_64.tar.gz
tar xf lazygit_0.44.0_Linux_x86_64.tar.gz
git init
./lazygit
stefanhaller commented 1 month ago

Hm, ok. I can reproduce it on my Mac when doing SHELL=bash lazygit from my zsh prompt:

$ SHELL=bash lazygit

+ bash -i -c date

Di 10 Sep 2024 09:57:16 CEST
zsh: suspended (tty output)  SHELL=bash lazygit
$

Note that it is my zsh that suspends the lazygit process, not bash.

A bit of cursory googling finds this, which sounds related. I'm still not sure what to make of this, I'm hoping somebody with more knowledge about this can suggest a fix. I'd hate to have to revert #3793, it's a useful feature.

Another data point: executing :date </dev/null in lazygit seems to work without suspending. Not that I'm suggesting this as a workaround, but maybe it can help shed some light.

huhu415 commented 1 month ago

i have the same issue, i am so confuse that i search everywhere. oh..

stkr commented 3 weeks ago

Just to add a bit more information, the behavior is reproducible also on WSL Ubuntu-24.04 with lazygit version 0.44.1_Linux_x86_64: