For spawned sessions, don't start the PTY immediately

This commit is contained in:
Peter Steinberger 2025-06-20 20:06:25 +02:00
parent f55e5b731d
commit 8b64f2088d

View file

@ -51,12 +51,20 @@ func (m *Manager) CreateSession(config Config) (*Session, error) {
return nil, err
}
// For spawned sessions, don't start the PTY immediately
// The PTY will be created when the spawned terminal connects
if !config.IsSpawned {
if err := session.Start(); err != nil {
if removeErr := os.RemoveAll(session.Path()); removeErr != nil {
log.Printf("[ERROR] Failed to remove session path after start failure: %v", removeErr)
}
return nil, err
}
} else {
if os.Getenv("VIBETUNNEL_DEBUG") != "" {
log.Printf("[DEBUG] Created spawned session %s - waiting for terminal to attach", session.ID[:8])
}
}
// Add to running sessions registry
m.mutex.Lock()
@ -76,12 +84,20 @@ func (m *Manager) CreateSessionWithID(id string, config Config) (*Session, error
return nil, err
}
// For spawned sessions, don't start the PTY immediately
// The PTY will be created when the spawned terminal connects
if !config.IsSpawned {
if err := session.Start(); err != nil {
if removeErr := os.RemoveAll(session.Path()); removeErr != nil {
log.Printf("[ERROR] Failed to remove session path after start failure: %v", removeErr)
}
return nil, err
}
} else {
if os.Getenv("VIBETUNNEL_DEBUG") != "" {
log.Printf("[DEBUG] Created spawned session %s with ID - waiting for terminal to attach", session.ID[:8])
}
}
// Add to running sessions registry
m.mutex.Lock()