@@ -469,27 +469,19 @@ func (s *Server) sessionStart(logger slog.Logger, session ssh.Session, env []str
469469 }
470470
471471 // plumb in envinfoer here to modify command for container exec?
472- cmd , err := s .CreateCommand (ctx , session .RawCommand (), env , nil )
473- if err != nil {
474- s .metrics .sessionErrors .WithLabelValues (magicTypeLabel , ptyLabel , "create_command" ).Add (1 )
475- return err
476- }
477-
472+ var ei usershell.EnvInfoer
473+ var err error
478474 if s .config .ExperimentalContainersEnabled && container != "" {
479- ei , err : = agentcontainers .EnvInfo (ctx , s .Execer , container , containerUser )
475+ ei , err = agentcontainers .EnvInfo (ctx , s .Execer , container , containerUser )
480476 if err != nil {
481477 s .metrics .sessionErrors .WithLabelValues (magicTypeLabel , ptyLabel , "container_env_info" ).Add (1 )
482478 return err
483479 }
484- modifiedCmd , modifiedArgs := ei .ModifyCommand (cmd .Path , cmd .Args ... )
485- if modifiedCmd != cmd .Path || slices .Compare (modifiedArgs , cmd .Args ) != 0 {
486- logger .Debug (ctx , "modified command for container" ,
487- slog .F ("before" , append ([]string {cmd .Path }, cmd .Args ... )),
488- slog .F ("after" , append ([]string {modifiedCmd }, modifiedArgs ... )),
489- )
490- cmd .Path = modifiedCmd
491- cmd .Args = modifiedArgs
492- }
480+ }
481+ cmd , err := s .CreateCommand (ctx , session .RawCommand (), env , ei )
482+ if err != nil {
483+ s .metrics .sessionErrors .WithLabelValues (magicTypeLabel , ptyLabel , "create_command" ).Add (1 )
484+ return err
493485 }
494486
495487 if ssh .AgentRequested (session ) {
0 commit comments