@@ -51,6 +51,7 @@ import (
51
51
"github.com/jesseduffield/lazygit/pkg/utils"
52
52
"github.com/samber/lo"
53
53
"github.com/sasha-s/go-deadlock"
54
+ "golang.org/x/sys/unix"
54
55
"gopkg.in/ozeidan/fuzzy-patricia.v3/patricia"
55
56
)
56
57
@@ -421,6 +422,20 @@ func (gui *Gui) getPerRepoConfigFiles() []*config.ConfigFile {
421
422
return repoConfigFiles
422
423
}
423
424
425
+ // setForegroundPgrp sets the current process group as the foreground process group
426
+ // for the terminal, allowing the program to read input after resuming from suspension.
427
+ func setForegroundPgrp () error {
428
+ fd , err := unix .Open ("/dev/tty" , unix .O_RDWR , 0 )
429
+ if err != nil {
430
+ return err
431
+ }
432
+ defer unix .Close (fd )
433
+
434
+ pgid := syscall .Getpgrp ()
435
+
436
+ return unix .IoctlSetPointerInt (fd , unix .TIOCSPGRP , pgid )
437
+ }
438
+
424
439
func (gui * Gui ) suspendApp (g * gocui.Gui , v * gocui.View ) error {
425
440
if runtime .GOOS == "windows" {
426
441
return nil
@@ -443,10 +458,15 @@ func (gui *Gui) handleResume(g *gocui.Gui) {
443
458
go func () {
444
459
sigs := make (chan os.Signal , 1 )
445
460
signal .Notify (sigs , syscall .SIGCONT )
446
- for range sigs {
447
- g .Resume ()
461
+
462
+ for sig := range sigs {
463
+ switch sig {
464
+ case syscall .SIGCONT :
465
+ setForegroundPgrp ()
466
+ g .Resume ()
467
+ gui .BackgroundRoutineMgr .PauseBackgroundRefreshes (false )
468
+ }
448
469
}
449
- gui .BackgroundRoutineMgr .PauseBackgroundRefreshes (false )
450
470
}()
451
471
}
452
472
0 commit comments