mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-08 19:08:40 -05:00
bootstrapper: ignore "journald" not in $PATH in constructor
In unit tests, NewCollector may be called on systems that do not have "journalctl" in $PATH. We can defer checking if the command can work by not checking cmd.Err in the constructor.
This commit is contained in:
parent
22d82a59ed
commit
bf06a014a4
@ -30,9 +30,6 @@ type Collector struct {
|
|||||||
// NewCollector creates a new Collector for journald logs.
|
// NewCollector creates a new Collector for journald logs.
|
||||||
func NewCollector(ctx context.Context) (*Collector, error) {
|
func NewCollector(ctx context.Context) (*Collector, error) {
|
||||||
cmd := exec.CommandContext(ctx, "journalctl")
|
cmd := exec.CommandContext(ctx, "journalctl")
|
||||||
if cmd.Err != nil {
|
|
||||||
return nil, cmd.Err
|
|
||||||
}
|
|
||||||
stdoutPipe, err := cmd.StdoutPipe()
|
stdoutPipe, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user