mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 11:58:16 +00:00
qemu: Use null QMP logger when the logger parameter is nil
Or else LaunchQemu() ends up dereferencing a nil pointer and panic'ing. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
7d4199a449
commit
f57201989b
4
qemu.go
4
qemu.go
@ -49,6 +49,10 @@ import (
|
|||||||
// will be returned if the launch succeeds. Otherwise a string containing
|
// will be returned if the launch succeeds. Otherwise a string containing
|
||||||
// the contents of stderr + a Go error object will be returned.
|
// the contents of stderr + a Go error object will be returned.
|
||||||
func LaunchQemu(ctx context.Context, params []string, fds []*os.File, logger QMPLog) (string, error) {
|
func LaunchQemu(ctx context.Context, params []string, fds []*os.File, logger QMPLog) (string, error) {
|
||||||
|
if logger == nil {
|
||||||
|
logger = qmpNullLogger{}
|
||||||
|
}
|
||||||
|
|
||||||
errStr := ""
|
errStr := ""
|
||||||
cmd := exec.Command("qemu-system-x86_64", params...)
|
cmd := exec.Command("qemu-system-x86_64", params...)
|
||||||
if len(fds) > 0 {
|
if len(fds) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user