master
go 32 lines 611 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 package postfix
4
5 import (
6 "time"
7
8 "github.com/netdata/netdata/go/plugins/logger"
9 "github.com/netdata/netdata/go/plugins/plugin/go.d/pkg/ndexec"
10 )
11
12 type postqueueBinary interface {
13 list() ([]byte, error)
14 }
15
16 func newPostqueueExec(binPath string, timeout time.Duration) *postqueueExec {
17 return &postqueueExec{
18 binPath: binPath,
19 timeout: timeout,
20 }
21 }
22
23 type postqueueExec struct {
24 *logger.Logger
25
26 binPath string
27 timeout time.Duration
28 }
29
30 func (p *postqueueExec) list() ([]byte, error) {
31 return ndexec.RunUnprivileged(p.Logger, p.timeout, p.binPath, "-p")
32 }