Skip to content

fix: use exec to eliminate redundant bash wrapper processes - #120

Open
uhs-robert wants to merge 1 commit into
jimeh:mainfrom
uhs-robert:fix/exec-replace-bash-wrappers
Open

fix: use exec to eliminate redundant bash wrapper processes#120
uhs-robert wants to merge 1 commit into
jimeh:mainfrom
uhs-robert:fix/exec-replace-bash-wrappers

Conversation

@uhs-robert

Copy link
Copy Markdown

Without exec, launching a session leaves two persistent bash processes: tmuxifier-load-session waiting on tmuxifier-tmux, which waits on tmux. With exec, each script replaces itself so only the tmux process remains.

Problem

Launching a session via tmuxifier load-session leaves two persistent bash processes alive for the lifetime of the session:

foot -> bash tmuxifier-load-session
        -> bash tmuxifier-tmux
        -> tmux attach-session

tmuxifier-load-session waits on tmuxifier-tmux which then waits on tmux. Both bash processes sit idle consuming memory with no useful work left to do after tmux has finished launching.

Fix

Use exec in two places so each script replaces itself rather than forking a child:

  • libexec/tmuxifier-tmux: exec tmux ... replaces the bash process with tmux directly
  • lib/layout-helpers.sh __go_to_session(): exec tmuxifier-tmux ... replaces the tmuxifier-load-session process, which then execs into tmux

Result

Only the tmux process remains, no leftover bash wrappers.

Without exec, launching a session leaves two persistent bash processes:
tmuxifier-load-session waiting on tmuxifier-tmux, which waits on tmux.
With exec, each script replaces itself so only the tmux process remains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant