mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
* Prevent recursive VibeTunnel sessions (GitHub #95) Added detection and prevention of nested VibeTunnel sessions to avoid recursive 'vt' command execution. Changes: - Set INSIDE_VIBETUNNEL and VIBETUNNEL_SESSION environment variables when creating PTY sessions - Added check in vt script to detect if already inside a VibeTunnel session - Shows helpful error message when recursive session is attempted This prevents the confusing behavior where users could run 'vt' inside a VibeTunnel session, creating nested terminal instances. Now users get a clear error message explaining they're already in a VibeTunnel session. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Improve recursive session prevention based on PR feedback - Consolidate to single environment variable VIBETUNNEL_SESSION_ID - Add session ID for debugging purposes as requested - Show session ID in error message for better user feedback - Remove redundant environment variables (INSIDE_VIBETUNNEL, VIBETUNNEL_SESSION) This addresses feedback from PR #104 to use a single, more informative environment variable that serves both purposes: preventing recursion and providing debugging information. --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9aaac17150
commit
fc162ad55c
2 changed files with 9 additions and 0 deletions
|
|
@ -1,6 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# VibeTunnel CLI wrapper
|
# VibeTunnel CLI wrapper
|
||||||
|
|
||||||
|
# Check if we're already inside a VibeTunnel session
|
||||||
|
if [ -n "$VIBETUNNEL_SESSION_ID" ]; then
|
||||||
|
echo "Error: Already inside a VibeTunnel session (ID: $VIBETUNNEL_SESSION_ID). Recursive VibeTunnel sessions are not supported." >&2
|
||||||
|
echo "If you need to run commands, use them directly without the 'vt' prefix." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Try standard locations first, but verify the binary exists
|
# Try standard locations first, but verify the binary exists
|
||||||
APP_PATH=""
|
APP_PATH=""
|
||||||
for TRY_PATH in "/Applications/VibeTunnel.app" "$HOME/Applications/VibeTunnel.app"; do
|
for TRY_PATH in "/Applications/VibeTunnel.app" "$HOME/Applications/VibeTunnel.app"; do
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,8 @@ export class PtyManager extends EventEmitter {
|
||||||
const ptyEnv = {
|
const ptyEnv = {
|
||||||
...process.env,
|
...process.env,
|
||||||
TERM: term,
|
TERM: term,
|
||||||
|
// Set session ID to prevent recursive vt calls and for debugging
|
||||||
|
VIBETUNNEL_SESSION_ID: sessionId,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Debug log the spawn parameters
|
// Debug log the spawn parameters
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue