Skip to content

Commit ba98345

Browse files
authored
Find NGINX worker processes in Debug mode (#1223)
1 parent a2cbcf7 commit ba98345

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/nginxprocess/process.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ type Process struct {
2828
}
2929

3030
// IsWorker returns true if the process is a NGINX worker process.
31-
func (p *Process) IsWorker() bool { return strings.HasPrefix(p.Cmd, "nginx: worker") }
31+
func (p *Process) IsWorker() bool {
32+
return strings.HasPrefix(p.Cmd, "nginx: worker") ||
33+
strings.HasPrefix(p.Cmd, "{nginx-debug} nginx: worker")
34+
}
3235

3336
// IsMaster returns true if the process is a NGINX master process.
3437
func (p *Process) IsMaster() bool {

pkg/nginxprocess/process_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func TestProcess_IsNginxWorker(t *testing.T) {
5555
cmd: "nginx: cache manager process",
5656
want: false,
5757
},
58+
"Test 5 nginx debug": {
59+
cmd: "{nginx-debug} nginx: worker process",
60+
want: true,
61+
},
5862
}
5963
for name, tc := range testcases {
6064
t.Run(name, func(t *testing.T) {

0 commit comments

Comments
 (0)