@@ -469,27 +469,19 @@ func (s *Server) sessionStart(logger slog.Logger, session ssh.Session, env []str
469
469
}
470
470
471
471
// 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
478
474
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 )
480
476
if err != nil {
481
477
s .metrics .sessionErrors .WithLabelValues (magicTypeLabel , ptyLabel , "container_env_info" ).Add (1 )
482
478
return err
483
479
}
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
493
485
}
494
486
495
487
if ssh .AgentRequested (session ) {
0 commit comments