broot icon indicating copy to clipboard operation
broot copied to clipboard

zsh: broot does not exit when terminal window closes

Open wAuner opened this issue 3 years ago • 2 comments

Describe the bug macOS 12.1 Terminal: iTerm2 Shell: zsh ARM Macbook

Terminal iTerm 2 and zsh When I run broot via br, do nothing but only close the terminal window, broot does not quit. Instead the process 'goes crazy' and its CPU usage sometimes goes up to 100% after a few seconds.

macOS Terminal and zsh broot doesnt quit, but CPU usage stays at 0,0%

iTerm2 and bash broot quits as expected

To Reproduce Steps to reproduce the behavior: Run br in iTerm and close the window/tab or iTerm completely. The broot process stays alive CPU usage goes up to 100%.

Expected behavior Process should quit as soon as the terminal window is closed.

Screenshots

CleanShot 2021-12-21 at 07 54 12@2x

Configuration (please complete the following information):

  • broot version: 1.7.5, arm build, installed via brew
  • OS: macOS 12.1
  • Relevant configuration items: zsh

Additional context Log:

07:53:59.815 [INFO] cli_log::init: Starting broot v1.7.5 with log level DEBUG
07:53:59.815 [DEBUG] broot::cli: Conf::from_default_location() took 125.291µs
07:53:59.815 [DEBUG] broot::cli: config: Conf {
    files: [
        "/Users/<username>/.config/broot/conf.hjson",
    ],
    default_flags: None,
    date_time_format: None,
    verbs: [
        VerbConf {
            invocation: Some(
                "edit",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "$EDITOR +{line} {file}",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: None,
            keys: [],
            shortcut: Some(
                "e",
            ),
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
        },
        VerbConf {
            invocation: Some(
                "create {subpath}",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "$EDITOR {directory}/{subpath}",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: None,
            keys: [],
            shortcut: None,
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
        },
        VerbConf {
            invocation: Some(
                "git_diff",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "git difftool -y {file}",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: None,
            keys: [],
            shortcut: Some(
                "gd",
            ),
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: None,
        },
        VerbConf {
            invocation: Some(
                "backup {version}",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: Some(
                "ctrl-b",
            ),
            keys: [],
            shortcut: None,
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: None,
            working_dir: None,
            description: None,
            auto_exec: Some(
                false,
            ),
        },
        VerbConf {
            invocation: Some(
                "terminal",
            ),
            internal: None,
            external: None,
            execution: Some(
                String(
                    "$SHELL",
                ),
            ),
            cmd: None,
            cmd_separator: None,
            key: Some(
                "ctrl-t",
            ),
            keys: [],
            shortcut: None,
            leave_broot: Some(
                false,
            ),
            from_shell: None,
            apply_to: None,
            set_working_dir: Some(
                true,
            ),
            working_dir: None,
            description: None,
            auto_exec: None,
        },
    ],
    skin: None,
    special_paths: {},
    search_modes: None,
    disable_mouse_capture: None,
    cols_order: None,
    show_selection_mark: Some(
        true,
    ),
    ext_colors: {},
    syntax_theme: None,
    true_colors: None,
    icon_theme: None,
    modal: None,
    max_panels_count: None,
    quit_on_last_cancel: None,
    file_sum_threads_count: None,
}
07:53:59.821 [DEBUG] broot::app::app_context: COLORTERM env variable = "truecolor"
07:53:59.821 [DEBUG] broot::app::app_context: true colors are available
07:53:59.821 [DEBUG] broot::tree_build::builder: GitIgnorer::default() took 0ns
07:53:59.838 [DEBUG] broot::kitty::image_renderer: TERM env var: Ok("xterm-256color")
07:53:59.840 [DEBUG] broot::app::app: display panel took 2.265833ms
07:53:59.843 [INFO] broot::app::app: pending_tasks took 208ns

wAuner avatar Dec 21 '21 07:12 wAuner

I reproduce the problem on Debian / gnome. Broot doesn't quit when it's launched by the br script inside zsh and the terminal is closed. No problem with bash. The problem is probably related to zsh or a ohmyzsh plugin.

Canop avatar Dec 21 '21 15:12 Canop

seems to be this issue: https://www.zsh.org/mla/users/2012/msg00667.html

(zsh not forwarding HUP to processes running in a function). Doesn't seem to be a plugin issue, I can reproduce with zsh -f. And it doesn't seem to be caused by any combination of the *_JOBS or HUP options.

baodrate avatar Jul 15 '22 17:07 baodrate