fix: start FUSE mount for remote sessions
Remote sessions had no local mount because WithMount9P hooks into the local execute.Server which does not exist for remote sessions. Start the mount directly and tear it down on kill/shutdown.
This commit is contained in:
parent
fce23afd28
commit
b95bab0ef8
|
|
@ -39,6 +39,7 @@ type Session struct {
|
|||
prevPrompt []byte // last submitted prompt; overwritten on each new submission
|
||||
peers map[string]bool // peer session IDs (bidirectional links)
|
||||
remote string // SSH target for remote execution (empty = local)
|
||||
mount *mountState // non-nil for remote sessions that need a local mount
|
||||
|
||||
// Cached model list (expensive API call; refreshed every 24h).
|
||||
modelsMu sync.Mutex
|
||||
|
|
@ -847,6 +848,9 @@ func (s *Manager) Shutdown() {
|
|||
if sess != nil {
|
||||
sess.Cancel()
|
||||
sess.Core.Close()
|
||||
if sess.mount != nil {
|
||||
teardownMount(sess.mount)
|
||||
}
|
||||
s.cfg.Log.Info("shutdown session %s", id)
|
||||
}
|
||||
}
|
||||
|
|
@ -860,6 +864,9 @@ func (s *Manager) KillSession(id string) {
|
|||
if sess != nil {
|
||||
sess.Cancel()
|
||||
sess.Core.Close()
|
||||
if sess.mount != nil {
|
||||
teardownMount(sess.mount)
|
||||
}
|
||||
s.removePersistedSession(id)
|
||||
s.cfg.Log.Info("killed session %s", id)
|
||||
if s.cfg.OnSessionKilled != nil {
|
||||
|
|
@ -1046,6 +1053,15 @@ func (s *Manager) CreateSession(args []string) (string, error) {
|
|||
sessPtr = sess
|
||||
sess.remote = remoteTarget
|
||||
|
||||
// For remote sessions, the mount isn't managed by a local execute.Server
|
||||
// (which doesn't exist). Start it directly so $OLLIE is available for
|
||||
// local prompt resolution.
|
||||
if remoteTarget != "" && !s.cfg.NoMount {
|
||||
ms := &mountState{envExtra: make(map[string]string)}
|
||||
startMount(ms, uname)
|
||||
sess.mount = ms
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
sess.uname = uname
|
||||
s.sessions[sessID] = sess
|
||||
|
|
|
|||
Reference in New Issue