diff --git a/qemu.go b/qemu.go index 9cc7145f47..b5760141e1 100644 --- a/qemu.go +++ b/qemu.go @@ -669,6 +669,9 @@ type Knobs struct { // NoGraphic completely disables graphic output. NoGraphic bool + + // Daemonize will turn the qemu process into a daemon + Daemonize bool } // Config is the qemu configuration structure. @@ -912,6 +915,10 @@ func (config *Config) appendKnobs() { if config.Knobs.NoGraphic == true { config.qemuParams = append(config.qemuParams, "-nographic") } + + if config.Knobs.Daemonize == true { + config.qemuParams = append(config.qemuParams, "-daemonize") + } } // LaunchQemu can be used to launch a new qemu instance. diff --git a/qemu_test.go b/qemu_test.go index 87e17ec9fe..18b016c62a 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -173,13 +173,14 @@ func TestAppendEmptyDevice(t *testing.T) { testAppend(device, "", t) } -var knobsString = "-no-user-config -nodefaults -nographic" +var knobsString = "-no-user-config -nodefaults -nographic -daemonize" func TestAppendKnobsAllTrue(t *testing.T) { knobs := Knobs{ NoUserConfig: true, NoDefaults: true, NoGraphic: true, + Daemonize: true, } testAppend(knobs, knobsString, t)