Skip to content

Interrupt signal kills window when launch --hold is used in a startup session #7466

@techsailor

Description

@techsailor

Description
I use a session to load a tab with a window running less following a search on a log-file (+F option). If I interrupt the follow using ctrl+c,(because I want to search backwards) then window is killed.

If I start less without the follow (+F option), then I can quit the less (using the q command) then start a new less - ctrl+c works as expected.

To Reproduce

Steps to reproduce the behavior:

  1. Start kitty with this command:
kitty -c none -o "map f2 send_text normal,application ps -fj;echo Notice command of first pid has changed\r" --session <(echo -e "layout vertical\nlaunch --hold less +/anacron|rotate +F /var/log/syslog\nlaunch --title Diagnose --hold sh -c 'ps -fj |cat ; echo Now press f2 to run the ps again'\nfocus\n")

  • When you use ctrl+c in less - the window is killed.

  • If you follow the tail (either using F command in less or by using +F option on command line), then it's impossible to interrupt less without the interrupt affecting the kitten which runs the less command, and the window is lost.

  • If you omit +F then it is possible to quit less (press q), and repeat command at the shell prompt less -i '+/anacron|rsnapshot|rotate' /var/log/syslog /var/log/syslog.1 either with or without +F option, then interrupt works as expected.

  1. Environment
kitty 0.33.1 (a5fea33757) created by Kovid Goyal
Linux lenou2004 5.15.0-84-generic #93~20.04.1-Ubuntu SMP Wed Sep 6 16:15:40 UTC 2023 x86_64
Ubuntu 20.04.6 LTS lenou2004 /dev/tty

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
Running under: Wayland
Frozen: True
Paths:
  kitty: /home/christian/.local/kitty.app/bin/kitty
  base dir: /home/christian/.local/kitty.app/lib/kitty
  extensions dir: /home/christian/.local/kitty.app/lib/kitty-extensions
  system shell: /bin/bash
Loaded config files:
  /etc/xdg/kitty/kitty.conf
Loaded config overrides:
  map f2 send_text normal,application ps -fj;echo Notice command of first pid has changed\r

Config options different from defaults:
update_check_interval 0.0
Added shortcuts:
	f2 →  send_text normal,application ps -fj;echo Notice command of first pid has changed\r

Important environment variables seen by the kitty process:
	PATH                                /home/christian/.local/kitty.app/bin:/home/christian/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
	LANG                                en_GB.UTF-8
	SHELL                               /bin/bash
	DISPLAY                             :0
	WAYLAND_DISPLAY                     wayland-0
	USER                                christian
	XDG_CONFIG_DIRS                     /etc/xdg/xdg-ubuntu-wayland:/etc/xdg
	XDG_MENU_PREFIX                     gnome-
	XDG_SESSION_DESKTOP                 ubuntu-wayland
	XDG_SESSION_TYPE                    wayland
	XDG_CURRENT_DESKTOP                 ubuntu:GNOME
	XDG_SESSION_CLASS                   user
	XDG_RUNTIME_DIR                     /run/user/1000
	XDG_DATA_DIRS                       /usr/share/ubuntu-wayland:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop

  1. Observation

I notice that the less process' Parent, is running "kitten run_shell ...", my guess is the kitten doesn't catch the interrupt signal and closes the window prematurely.

When less is quit normally then the same PID is now running bash, which catches the interrupt.

So my guess is, kitten run-shell ... doesn't catch the interrupt and closes the window prematurely.

UID          PID    PPID    PGID     SID  C STIME TTY          TIME CMD
christi+   46068   46059   46068   46068  0 11:06 pts/5    00:00:00 /home/christian/.local/kitty.app/bin/kitten run-shell --shell=/bin/bash --shell-integration=enabled --env=KITTY_HOLD=1 /usr/bin/sh -c ps -fj |cat ; echo Now press f2 to run the ps again
christi+   46087   46068   46068   46068  0 11:06 pts/5    00:00:00 /usr/bin/sh -c ps -fj |cat ; echo Now press f2 to run the ps again
christi+   46088   46087   46068   46068  0 11:06 pts/5    00:00:00 ps -fj
christi+   46089   46087   46068   46068  0 11:06 pts/5    00:00:00 cat
Now press f2 to run the ps again
$ ps -fj;echo Notice command of first pid has changed
UID          PID    PPID    PGID     SID  C STIME TTY          TIME CMD
christi+   46068   46059   46068   46068  0 11:06 pts/5    00:00:00 /bin/bash --posix
christi+   46109   46068   46109   46068  0 11:07 pts/5    00:00:00 ps -fj
Notice command of first pid has changed
$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions