mirror of
https://github.com/obra/superpowers.git
synced 2026-08-07 14:48:47 +08:00
fix(e2e): gate tmux ownership on creation success
Make the copyable recipe independent of ambient set -e behavior. A failed tmux new-session now reports the failure and exits while session_owned is still false; only a successful creation reaches the ownership assignment. A real collision reproduced the prior snippet killing its sentinel after marking a failed creation as owned. The guarded version preserved the exact sentinel identity, and three refined fresh-agent runs again preserved IDs 17, 18, and 19 while cleaning only their fallback sessions.
This commit is contained in:
@@ -19,7 +19,10 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
tmux new-session -d -s "$session" -x 200 -y 50 "<cmd> 2>\"$stderr_log\""
|
||||
if ! tmux new-session -d -s "$session" -x 200 -y 50 "<cmd> 2>\"$stderr_log\""; then
|
||||
echo "failed to create tmux session: $session" >&2
|
||||
exit 1
|
||||
fi
|
||||
session_owned=1
|
||||
tmux send-keys -t "$session" -l "literal text" # -l = no key-name parsing (paths, slashes)
|
||||
tmux send-keys -t "$session" Enter
|
||||
|
||||
Reference in New Issue
Block a user