jesseduffield / jesseduffield/lazygit
Starting long-living command without monitoring it
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
**Describe the bug**
I have a custom command with a keybinding that is supposed to start a new terminal window in the git directory that is currently active in lazygit. It works, however lazygit will monitor the processes it created, no matter what.
In monitoring it, lazygit takes quite a porting of cpu time and it also shows a spinner in the status line, indicating there is a command running.
I have tried with `subprocess: true | false`, `stream: true | false`; I have created intermediate bash script that starts the program detached (via `&`), it redirects stdout, stderr, it closes stdin - to no success. I have also tried to `disown` the forked process, also no success.
So the problem is twofold:
a) monitoring processes take noticeable cpu time
b) the status indicator spins.
**To Reproduce**
Custom command to start a terminal, ie:
```yaml
- key: ''
command: '$HOME/.config/jesseduffield/lazygit/shell.sh'
context: 'files'
subprocess: true
```
`shell.sh` would look like:
```bash
#!/bin/bash
exec 0<&-
wezterm start --always-new-process --cwd . >>$HOME/wezterm.log 2>>$HOME/wezterm.log
```
**Expected behavior**
No status line indication and no cpu consumption.
**Version info:**
```shell
$ lazygit --version
commit=v0.44.1, build date=2024-09-18T13:19:48Z, build source=binaryRelease, version=0.44.1, os=linux, arch=amd64, git version=2.46.2
```
```shell
$ git --version
git version 2.46.2
```
Contributor guide
Assessment
This issue has not been assessed yet.