Skip to content

Commit cd71376

Browse files
authored
Merge pull request #3075 from afbjorklund/ssh-log-level-quiet
Revert to quiet log level for older ssh versions
2 parents 9be3b9a + e827f2b commit cd71376

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/limactl/shell.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010

1111
"al.essio.dev/pkg/shellescape"
12+
"github.com/coreos/go-semver/semver"
1213
"github.com/lima-vm/lima/pkg/sshutil"
1314
"github.com/lima-vm/lima/pkg/store"
1415
"github.com/mattn/go-isatty"
@@ -184,8 +185,15 @@ func shellAction(cmd *cobra.Command, args []string) error {
184185
// SendEnv config is cumulative, with already existing options in ssh_config
185186
sshArgs = append(sshArgs, "-o", "SendEnv=COLORTERM")
186187
}
188+
logLevel := "ERROR"
189+
// For versions older than OpenSSH 8.9p, LogLevel=QUIET was needed to
190+
// avoid the "Shared connection to 127.0.0.1 closed." message with -t.
191+
olderSSH := sshutil.DetectOpenSSHVersion().LessThan(*semver.New("8.9.0"))
192+
if olderSSH {
193+
logLevel = "QUIET"
194+
}
187195
sshArgs = append(sshArgs, []string{
188-
"-o", "LogLevel=ERROR",
196+
"-o", fmt.Sprintf("LogLevel=%s", logLevel),
189197
"-p", strconv.Itoa(inst.SSHLocalPort),
190198
inst.SSHAddress,
191199
"--",

0 commit comments

Comments
 (0)