Skip to content

Commit 849a71f

Browse files
committed
PR feedback
1 parent 97ffc4b commit 849a71f

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

src/core/environment.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,7 @@ func (env *EnvironmentType) Processes() (result []*Process) {
656656
}
657657

658658
func (env *EnvironmentType) isNginxProcess(name string, cmd string) bool {
659-
base := filepath.Base(name) // strip path if any
660-
661-
// Accept both the normal nginx binary and the debug binary
662-
isNginxBinary := base == "nginx" || base == "nginx-debug"
663-
664-
return isNginxBinary && !strings.Contains(cmd, "upgrade") && strings.HasPrefix(cmd, "nginx:")
659+
return !strings.Contains(cmd, "upgrade") && (strings.HasPrefix(cmd, "nginx:") || strings.HasPrefix(cmd, "{nginx-debug} nginx:"))
665660
}
666661

667662
func getNginxProcessExe(nginxProcess *process.Process) string {

src/core/environment_test.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,29 +1146,11 @@ func TestGetNginxProcess(t *testing.T) {
11461146
expect: false,
11471147
},
11481148
{
1149-
name: "nginx binary with master cmd",
1150-
pName: "nginx",
1151-
cmd: "nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf",
1152-
expect: true,
1153-
},
1154-
{
1155-
name: "nginx-debug binary with master cmd",
1149+
name: "nginx-debug process",
11561150
pName: "nginx-debug",
1157-
cmd: "nginx: master process /usr/sbin/nginx-debug -c /etc/nginx/nginx.conf",
1151+
cmd: "{nginx-debug} nginx: master process /usr/sbin/nginx-debug -g daemon off;",
11581152
expect: true,
11591153
},
1160-
{
1161-
name: "nginx-asg-sync shouldn't match",
1162-
pName: "nginx-asg-sync",
1163-
cmd: "/usr/sbin/nginx-asg-sync -log_path=/var/log/...",
1164-
expect: false,
1165-
},
1166-
{
1167-
name: "nginx upgrade excluded",
1168-
pName: "nginx",
1169-
cmd: "nginx: upgrade",
1170-
expect: false,
1171-
},
11721154
}
11731155

11741156
for _, tt := range tests {

0 commit comments

Comments
 (0)