Skip to content

Commit 3127cba

Browse files
committed
only log modified command at debug if changed
1 parent 6fffa6b commit 3127cba

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

agent/agentssh/agentssh.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,13 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string,
765765

766766
// Modify command prior to execution. This will usually be a no-op, but not always.
767767
modifiedName, modifiedArgs := ei.ModifyCommand(name, args...)
768-
s.logger.Info(ctx, "modified command",
769-
slog.F("before", append([]string{name}, args...)),
770-
slog.F("after", append([]string{modifiedName}, modifiedArgs...)),
771-
)
768+
// Log if the command was modified.
769+
if modifiedName != name && slices.Compare(modifiedArgs, args) != 0 {
770+
s.logger.Debug(ctx, "modified command",
771+
slog.F("before", append([]string{name}, args...)),
772+
slog.F("after", append([]string{modifiedName}, modifiedArgs...)),
773+
)
774+
}
772775
cmd := s.Execer.PTYCommandContext(ctx, modifiedName, modifiedArgs...)
773776
cmd.Dir = s.config.WorkingDirectory()
774777

0 commit comments

Comments
 (0)