Skip to content

Commit 254a5b6

Browse files
committed
Add constant for JetBrains magic string
1 parent 4d65478 commit 254a5b6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

agent/agentssh/agentssh.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ const (
4747
MagicSessionTypeEnvironmentVariable = "CODER_SSH_SESSION_TYPE"
4848
// MagicSessionTypeVSCode is set in the SSH config by the VS Code extension to identify itself.
4949
MagicSessionTypeVSCode = "vscode"
50-
// MagicSessionTypeJetBrains is set in the SSH config by the JetBrains extension to identify itself.
50+
// MagicSessionTypeJetBrains is set in the SSH config by the JetBrains
51+
// extension to identify itself.
5152
MagicSessionTypeJetBrains = "jetbrains"
53+
// MagicProcessCmdlineJetBrains is a string in a process's command line that
54+
// uniquely identifies it as JetBrains software.
55+
MagicProcessCmdlineJetBrains = "idea.vendor.name=JetBrains"
5256
)
5357

5458
type Server struct {

agent/agentssh/jetbrainstrack.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ func NewJetbrainsChannelWatcher(ctx ssh.Context, logger slog.Logger, newChannel
4646
}
4747

4848
// If this is not JetBrains, then we do not need to do anything special. We
49-
// attempt to match on something that appears unique to JetBrains software and
50-
// the vendor name flag seems like it might be a reasonable choice.
51-
if !strings.Contains(strings.ToLower(cmdline), "idea.vendor.name=jetbrains") {
49+
// attempt to match on something that appears unique to JetBrains software.
50+
if !strings.Contains(strings.ToLower(cmdline), strings.ToLower(MagicProcessCmdlineJetBrains)) {
5251
return newChannel
5352
}
5453

0 commit comments

Comments
 (0)