Skip to content

Close confirmation with shell integration does not account for backgrounded tasks #8358

@00-kat

Description

@00-kat

Describe the bug
The close confirmation does not take into account backgrounded tasks, and only cares about whether the user is currently at a prompt or not. This is much easier to describe using reproduction steps; see below.

To Reproduce
Steps to reproduce the behavior:

  1. Run kitty --config NONE. Make sure that you are using a shell which Kitty has shell integration for (I tried all three of Fish, Zsh and Bash using kitty --config NONE --override 'shell=XXX').
  2. Run cat in the new Kitty window. Try to close the window. Observe the confirmation prompt.
  3. Dismiss the confirmation prompt from step three. cat should still be running
  4. Press ctrl+z, or whatever the keybinding to background a job is.
  5. Try to close the window. Observe that there is no confirmation prompt.
  6. Run kitty --config NONE again, with the same shell as before.
  7. Run cat in the new Kitty window, background it (ctrl+z), run fg to bring it back to the foreground, and try close the window. Observe that there is a confirmation prompt, because you are not currently at a prompt.
  8. Background the cat from step 7 again (ctrl+z). Run a new cat, and background it as well. Run fg to bring it back to the foreground, and try close the window. Once again observe that there is a confirmation prompt, because you are not currently at a prompt.
  9. Background the second cat from step 8 again (ctrl+z). Try close the window one last time, and notice that there is no confirmation because you are currently at a prompt.

Screenshots
Here's a video instead:

recording.mp4

I apologise for going so fast; the video would be too large for GitHub had I gone much slower.

Environment details

Click or tap to unhide the environment details.
kitty 0.39.1 created by Kovid Goyal
Linux sycorax 6.12.12-hardened1-2-hardened #1 SMP PREEMPT_DYNAMIC Sat, 08 Feb 2025 14:16:33 +0000 x86_64
S{PRETTY_NAME} 6.12.12-hardened1-2-hardened (/dev/tty)

Running under: Wayland (Hyprland v0.47.2,) missing: blur
OpenGL: '4.6 (Core Profile) Mesa 24.3.4-arch1.1' Detected version: 4.6
Frozen: False
Fonts:
  medium: JetBrainsMono-Regular: /usr/share/fonts/TTF/JetBrainsMono-Regular.ttf:0
          Features: ('zero', 'cv06', 'cv07', 'cv11', 'cv12', 'cv16')
    bold: JetBrainsMono-SemiBold: /usr/share/fonts/TTF/JetBrainsMono-SemiBold.ttf:0
          Features: ('zero', 'cv06', 'cv07', 'cv11', 'cv12', 'cv16')
  italic: JetBrainsMono-Italic: /usr/share/fonts/TTF/JetBrainsMono-Italic.ttf:0
          Features: ('zero', 'cv06', 'cv07', 'cv11', 'cv12', 'cv16')
      bi: JetBrainsMono-SemiBoldItalic: /usr/share/fonts/TTF/JetBrainsMono-SemiBoldItalic.ttf:0
          Features: ('zero', 'cv06', 'cv07', 'cv11', 'cv12', 'cv16')
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/fish
System color scheme: no_preference. Applied color theme type: none

Config options different from defaults:

Important environment variables seen by the kitty process:
	PATH                                /usr/lib/ccache/bin:/home/kat/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/rocm/bin:/usr/lib/rustup/bin:/usr/lib/plan9/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/rocm/bin:/usr/lib/rustup/bin:/usr/lib/plan9/bin
	LANG                                en_AU.UTF-8
	VISUAL                              nvim
	EDITOR                              nvim
	SHELL                               /usr/bin/fish
	DISPLAY                             :0
	WAYLAND_DISPLAY                     wayland-1
	USER                                kat
	XCURSOR_SIZE                        28
	XDG_DATA_HOME                       /home/kat/.local/share
	XDG_CONFIG_HOME                     /home/kat/.config
	XDG_CACHE_HOME                      /home/kat/.cache
	XDG_CURRENT_DESKTOP                 Hyprland
	XDG_STATE_HOME                      /home/kat/.local/state
	XDG_BACKEND                         wayland
	XDG_VTNR                            2
	XDG_SESSION_TYPE                    wayland
	XDG_SEAT                            seat0
	XDG_SESSION_ID                      1
	XDG_SESSION_CLASS                   user
	XDG_RUNTIME_DIR                     /run/user/1000

Note: I can reproduce this with Bash and Zsh too.

Additional context
One thing to be aware of when attempting to fix this is that disowned jobs should not result in a prompt when closing Kitty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions