Skip to content

Generated shell.zsh uses 'exit 0' instead of 'return 0', causing shell to terminate #753

@ianks

Description

@ianks

Bug Description

When antigen generates the ~/.antigen/shell.zsh file, it includes a check for an existing Ruby helper process. If found, it uses exit 0 which terminates the entire shell session instead of just returning from the script.

The Problem

The generated shell.zsh contains:

[[ -f "$PID_FILE" ]] && PID=$(<"$PID_FILE") && [[ "$PID" =~ ^[0-9]+$ ]] && \
    kill -0 "$PID" 2>/dev/null && ps -p "$PID" -o comm= | grep -q ruby && exit 0

This causes the shell to completely exit when:

  1. Starting a new tmux window/pane
  2. Opening a new terminal tab
  3. Any situation where a new shell is spawned while the Ruby helper is already running

The Fix

Replace exit 0 with return 0:

[[ -f "$PID_FILE" ]] && PID=$(<"$PID_FILE") && [[ "$PID" =~ ^[0-9]+$ ]] && \
    kill -0 "$PID" 2>/dev/null && ps -p "$PID" -o comm= | grep -q ruby && return 0

Impact

This bug makes it impossible to create new tmux windows or terminal sessions when antigen's Ruby helper process is running, severely impacting usability.

Environment

  • OS: macOS
  • Shell: zsh 5.9
  • Antigen: latest
  • Tmux: 3.5

Workaround

Users can manually edit ~/.antigen/shell.zsh and change exit 0 to return 0, but this file may be regenerated by antigen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions