package tests

import (
	
	
	
	
	

	
)

const journalctlTimeout = time.Second

func ( int,  string) (*fastjson.Object, error) {
	, ,  := os.Pipe()
	if  != nil {
		return nil, 
	}
	defer func() { _ = .Close() }()
	defer func() { _ = .Close() }()

	 := time.Now().Add(journalctlTimeout)
	if  := .SetReadDeadline();  != nil {
		return nil, 
	}

	// Journal adds entries asynchronously from the sending process. We
	// assume that there is at most one entry with the given message per
	// process and follow the log until the first entry.
	 := exec.Command("journalctl",
		"-a", "-f",
		"-o", "json",
		"-n", "1",
		"_PID="+strconv.Itoa(),
		"MESSAGE="+,
	)
	.Stdout = 
	if  := .Start();  != nil {
		return nil, 
	}
	defer func() {
		_ = .Process.Kill()
		_ = .Wait()
	}()

	var  json.RawMessage
	if  := json.NewDecoder().Decode(&);  != nil {
		return nil, 
	}

	,  := fastjson.ParseBytes()
	if  != nil {
		return nil, 
	}
	return .Object()
}