[BUG] bash processes left around after exit

Resolved 💬 5 comments Opened May 18, 2025 by joshalbrecht Closed Jan 3, 2026

Environment

  • Platform (select one):
  • [X ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.118 (Claude Code)
  • Operating System: Ubuntu 22.04
  • Terminal: xfce4-terminal

Bug Description

each time it is launched, claude launches some sort of bash command that just hangs forever

Steps to Reproduce

  1. type claude, hit enter
  2. use the /exit command (or ctrl-c) to exit
  3. run ps -Fe
  4. see yet another /bin/bash instance still hanging around

Expected Behavior

I expect claude not to leave processes laying around when exiting

Actual Behavior

There is an extra bash command still running

Additional Context

The command that is running is always something like this:

/bin/bash -c -l SNAPSHOT_FILE=/tmp/claude-shell-snapshot-dcc7       source "/home/user/.bashrc" < /dev/null              # First, create/clear the snapshot file       echo "# Snapshot file" >| $SNAPSHOT_FILE              # When this file is sourced, we first unalias to avoid conflicts       # This is necessary because aliases get "frozen" inside function definitions at definition time,       # which can cause unexpected behavior when functions use commands that conflict with aliases       echo "# Unset all aliases to avoid conflicts with functions" >> $SNAPSHOT_FILE       echo "unalias -a 2>/dev/null || true" >> $SNAPSHOT_FILE                     echo "# Functions" >> $SNAPSHOT_FILE              # Force autoload all functions first       declare -f > /dev/null 2>&1              # Now get user function names - filter system ones and give the rest to eval in b64 encoding       declare -F | cut -d' ' -f3 | grep -vE '^(_|__)' | while read func; do         # Encode the function to base64, preserving all special characters         encoded_func=$(declare -f "$func" | base64 )         # Write the function definition to the snapshot         echo "eval \"\$(echo '$encoded_func' | base64 -d)\" > /dev/null 2>&1" >> $SNAPSHOT_FILE       done        echo "# Shell Options" >> $SNAPSHOT_FILE       shopt -p | head -n 1000 >> $SNAPSHOT_FILE       set -o | grep "on" | awk '{print "set -o " $1}' | head -n 1000 >> $SNAPSHOT_FILE       echo "shopt -s expand_aliases" >> $SNAPSHOT_FILE                   echo "# Aliases" >> $SNAPSHOT_FILE       alias | sed 's/^alias //g' | sed 's/^/alias -- /' | head -n 1000 >> $SNAPSHOT_FILE              # Add PATH to the file       echo "export PATH='/home/user/.fly/bin:/home/user/.bun/bin:/home/user/.poetry/bin:/home/user/.pyenv/plugins/pyenv-virtualenv/shims:/home/user/.pyenv/shims:/home/user/.pyenv/bin:/home/user/local/bin:/home/user/.fly/bin'" >> $SNAPSHOT_FILE

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗