File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,12 @@ func (env *EnvironmentType) Processes() (result []*Process) {
656656}
657657
658658func (env * EnvironmentType ) isNginxProcess (name string , cmd string ) bool {
659- return name == "nginx" && ! strings .Contains (cmd , "upgrade" ) && strings .HasPrefix (cmd , "nginx:" )
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:" )
660665}
661666
662667func getNginxProcessExe (nginxProcess * process.Process ) string {
Original file line number Diff line number Diff line change @@ -1145,6 +1145,30 @@ func TestGetNginxProcess(t *testing.T) {
11451145 cmd : "nginx: upgrade" ,
11461146 expect : false ,
11471147 },
1148+ {
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" ,
1156+ pName : "nginx-debug" ,
1157+ cmd : "nginx: master process /usr/sbin/nginx-debug -c /etc/nginx/nginx.conf" ,
1158+ expect : true ,
1159+ },
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+ },
11481172 }
11491173
11501174 for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments