qemu
software (TCG) emulation by default — so embedded firmware and homelabOS images can be exercised in a pipeline before being flashed to real
hardware. One object model serves two audiences: microcontroller / SBC
firmware (boot a kernel + rootfs and watch the serial console) and full
server/SBC OS images (boot a disk image as a long-running service and
reach it over forwarded ports).
TCG is the default acceleration; KVM is selectable but requires an engine
with /dev/kvm (this module does not provide it). The base image is a
module-pinned Alpine (`apk add qemu-system- qemu-img`); only a
`registry` prefix is caller-overridable, for air-gapped mirrors.
File map (all `package main`, surfaced as one Dagger module):
- enums.go — Arch / Accel / DiskFormat / DiskInterface enums plus the
internal per-arch tables (qemu binary, apk package,
default machine/cpu, net front-end) and token mappings.
- machine.go — *Machine + Qemu.Linux / Qemu.Disk constructors, input
validation, the QEMU argv builder, and per-arch defaults.
- drive.go — the two *Machine drive modes: service-bind (Host /
Endpoint / Service / Bind / Stop) and run-to-completion
(Run / WaitForLine / SerialLog), plus the workdir stager.
Installation
dagger install github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453Entrypoint
Return Type
Qemu Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
func (m *MyModule) Example() *dagger.Qemu {
return dag.
Qemu()
}@function
def example() -> dagger.Qemu:
return (
dag.qemu()
)@func()
example(): Qemu {
return dag
.qemu()
}Types
Qemu 🔗
Qemu is the root namespace for every exported function in this module.
The machine constructors hang off *Qemu so the generated Dagger SDK
surfaces them under dag.Qemu().<Func>(...).
bareMetal() 🔗
BareMetal boots a bare-metal microcontroller firmware directly — no Linux kernel, initrd, rootfs, or device tree — on an MCU-class machine, with ARM/RISC-V semihosting enabled. This is the off-device unit-test path for embedded firmware: a test build can write to the host console (semihosting SYS_WRITE0) and report pass/fail as a process exit code (semihosting SYS_EXIT) via Machine.RunStatus — neither of which the kernel-oriented Linux path can surface (it captures serial text only).
arch selects the qemu-system- binary and an MCU-class machine
default distinct from the SoC defaults Linux/Disk use (ARM => lm3s6965evb +
cortex-m3, RISC-V => virt); an explicit machine / cpu overrides it.
Acceleration is always TCG — MCU targets have no KVM analog. Semihosting is
on by default (-semihosting-config enable=on,target=native lets the guest’s
semihosting calls reach the host so SYS_EXIT maps to the QEMU process exit
code); pass disableSemihosting for firmware that drives a real UART instead
and wants neither the host console route nor SYS_EXIT wiring. The option is
inverted so the Go SDK can actually turn semihosting off — a `bool can’t be set false through the generated bindings (false is the zero
value and is dropped). Rejects a nil firmware and an arch with no bare-metal
profile.
Session-cached on name like Linux/Disk; every *Machine method is
never-cached so each Run / RunStatus re-executes.
Return Type
Machine !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| firmware | File ! | - | No description provided |
| arch | Enum ! | "ARM" | No description provided |
| machine | String ! | "" | No description provided |
| cpu | String ! | "" | No description provided |
| memoryMb | Integer ! | 16 | No description provided |
| disableSemihosting | Boolean ! | false | No description provided |
| cmdline | String ! | "" | No description provided |
| registry | String ! | "docker.io" | No description provided |
| name | String ! | "" | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
bare-metal --firmware file:path --machine string --cpu string --memory-mb integer --disable-semihosting boolean --cmdline string --registry string --name stringfunc (m *MyModule) Example(firmware *dagger.File, arch , machine string, cpu string, memoryMb int, disableSemihosting bool, cmdline string, registry string, name string) *dagger.QemuMachine {
return dag.
Qemu().
Baremetal(firmware, arch, machine, cpu, memoryMb, disableSemihosting, cmdline, registry, name)
}@function
def example(firmware: dagger.File, arch: , machine: str, cpu: str, memorymb: int, disablesemihosting: bool, cmdline: str, registry: str, name: str) -> dagger.QemuMachine:
return (
dag.qemu()
.baremetal(firmware, arch, machine, cpu, memorymb, disablesemihosting, cmdline, registry, name)
)@func()
example(firmware: File, arch: , machine: string, cpu: string, memoryMb: number, disableSemihosting: boolean, cmdline: string, registry: string, name: string): QemuMachine {
return dag
.qemu()
.bareMetal(firmware, arch, machine, cpu, memoryMb, disableSemihosting, cmdline, registry, name)
}disk() 🔗
Disk boots a guest from a bootable disk image as a long-running machine —
the full-OS path. format / iface map to -drive format=/if=; an
optional bios supplies firmware. Empty machine / cpu resolve to the
per-arch default. Rejects a nil image and an unknown arch.
Return Type
Machine !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| image | File ! | - | No description provided |
| arch | Enum ! | "AARCH_64" | No description provided |
| machine | String ! | "" | No description provided |
| cpu | String ! | "" | No description provided |
| memoryMb | Integer ! | 1024 | No description provided |
| accel | Enum ! | "TCG" | No description provided |
| format | Enum ! | "RAW" | No description provided |
| iface | Enum ! | "VIRTIO" | No description provided |
| bios | File | - | No description provided |
| cmdline | String ! | "" | No description provided |
| tcpPorts | [Integer ! ] | - | No description provided |
| registry | String ! | "docker.io" | No description provided |
| name | String ! | "" | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
disk --image file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name stringfunc (m *MyModule) Example(image *dagger.File, arch , machine string, cpu string, memoryMb int, accel , format , iface , cmdline string, registry string, name string) *dagger.QemuMachine {
return dag.
Qemu().
Disk(image, arch, machine, cpu, memoryMb, accel, format, iface, cmdline, registry, name)
}@function
def example(image: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , format: , iface: , cmdline: str, registry: str, name: str) -> dagger.QemuMachine:
return (
dag.qemu()
.disk(image, arch, machine, cpu, memorymb, accel, format, iface, cmdline, registry, name)
)@func()
example(image: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , format: , iface: , cmdline: string, registry: string, name: string): QemuMachine {
return dag
.qemu()
.disk(image, arch, machine, cpu, memoryMb, accel, format, iface, cmdline, registry, name)
}linux() 🔗
Linux boots a guest from a raw kernel (plus optional dtb / initrd / rootfs)
— the firmware / SBC path. arch selects the qemu-system- binary;
empty machine / cpu resolve to the per-arch default (AARCH64 => virt +
cortex-a53). Each tcpPorts entry is forwarded hostfwd=tcp::P-:P and
exposed at the same number. Rejects a nil kernel and an unknown arch.
Session-cached on name so parallel callers get independent backing
services; every *Machine method is never-cached so each Run / Service
re-executes. Pass a unique name per parallel test for isolation.
Return Type
Machine !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| kernel | File ! | - | No description provided |
| dtb | File | - | No description provided |
| initrd | File | - | No description provided |
| rootfs | File | - | No description provided |
| arch | Enum ! | "AARCH_64" | No description provided |
| machine | String ! | "" | No description provided |
| cpu | String ! | "" | No description provided |
| memoryMb | Integer ! | 512 | No description provided |
| accel | Enum ! | "TCG" | No description provided |
| cmdline | String ! | "" | No description provided |
| tcpPorts | [Integer ! ] | - | No description provided |
| registry | String ! | "docker.io" | No description provided |
| name | String ! | "" | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name stringfunc (m *MyModule) Example(kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string) *dagger.QemuMachine {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
}@function
def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str) -> dagger.QemuMachine:
return (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
)@func()
example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string): QemuMachine {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
}Machine 🔗
Machine is a configured-but-not-necessarily-running QEMU guest. It carries both drive modes: a long-running *dagger.Service (mode A, for OS images reached over forwarded ports) and a finite run argv replayed per call (mode B, for firmware that prints to serial and powers off). See drive.go.
bind() 🔗
Bind attaches the guest service to ctr under the machine’s hostname so ctr
can dial the forwarded ports at Host().
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ctr | Container ! | - | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
bind --ctr IMAGE:TAGfunc (m *MyModule) Example(kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, ctr *dagger.Container) *dagger.Container {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Bind(ctr)
}@function
def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, ctr: dagger.Container) -> dagger.Container:
return (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.bind(ctr)
)@func()
example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, ctr: Container): Container {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.bind(ctr)
}endpoint() 🔗
Endpoint returns host:port for a forwarded TCP port, erroring if the port
was not in the machine’s tcpPorts.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| port | Integer ! | - | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
endpoint --port integerfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, port int) string {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Endpoint(ctx, port)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, port: int) -> str:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.endpoint(port)
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, port: number): Promise<string> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.endpoint(port)
}host() 🔗
Host returns the per-machine hostname the backing service is reachable at.
Return Type
String ! Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
hostfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string) string {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Host(ctx)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str) -> str:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.host()
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string): Promise<string> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.host()
}run() 🔗
Run boots the guest to completion (-no-reboot) and returns the captured
serial console. A guest that powers off exits before timeoutSeconds; one
that doesn’t is killed at the deadline and whatever serial it produced is
returned.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| timeoutSeconds | Integer ! | 300 | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
run --timeout-seconds integerfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, timeoutSeconds int) string {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Run(ctx, timeoutSeconds)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, timeoutseconds: int) -> str:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.run(timeoutseconds)
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, timeoutSeconds: number): Promise<string> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.run(timeoutSeconds)
}runStatus() 🔗
RunStatus boots the guest to completion like Run, but returns both the captured serial console and the guest exit code in a single boot — the bare-metal counterpart to Run, where the semihosting SYS_EXIT code carries pass/fail that serial text alone can’t. Run / WaitForLine / SerialLog are unchanged and still return serial only.
Return Type
RunResult !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| timeoutSeconds | Integer ! | 300 | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
run-status --timeout-seconds integerfunc (m *MyModule) Example(kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, timeoutSeconds int) *dagger.QemuRunResult {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Runstatus(timeoutSeconds)
}@function
def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, timeoutseconds: int) -> dagger.QemuRunResult:
return (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.runstatus(timeoutseconds)
)@func()
example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, timeoutSeconds: number): QemuRunResult {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.runStatus(timeoutSeconds)
}serialLog() 🔗
SerialLog runs the guest and materializes the captured serial console as a *dagger.File via the module workdir — no helper container.
Return Type
File !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| timeoutSeconds | Integer ! | 300 | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
serial-log --timeout-seconds integerfunc (m *MyModule) Example(kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, timeoutSeconds int) *dagger.File {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Seriallog(timeoutSeconds)
}@function
def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, timeoutseconds: int) -> dagger.File:
return (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.seriallog(timeoutseconds)
)@func()
example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, timeoutSeconds: number): File {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.serialLog(timeoutSeconds)
}service() 🔗
Service returns the long-running guest as a *dagger.Service. Consumers can bind it (see Bind) and reach forwarded ports at Endpoint.
Return Type
Service ! Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
servicefunc (m *MyModule) Example(kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string) *dagger.Service {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Service()
}@function
def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str) -> dagger.Service:
return (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.service()
)@func()
example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string): Service {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.service()
}stop() 🔗
Stop tears down the backing service. Tests should defer this so the service span closes when the test returns. SIGKILL skips graceful shutdown.
Return Type
Void ! Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
stopfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string) {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Stop(ctx)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str) -> None:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.stop()
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string): Promise<void> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.stop()
}waitForLine() 🔗
WaitForLine runs the guest and returns the serial console only if it contains substr, erroring otherwise.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| substr | String ! | - | No description provided |
| timeoutSeconds | Integer ! | 300 | No description provided |
Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
wait-for-line --substr string --timeout-seconds integerfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, substr string, timeoutSeconds int) string {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Waitforline(ctx, substr, timeoutSeconds)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, substr: str, timeoutseconds: int) -> str:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.waitforline(substr, timeoutseconds)
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, substr: string, timeoutSeconds: number): Promise<string> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.waitForLine(substr, timeoutSeconds)
}RunResult 🔗
RunResult pairs the serial console output of a finite boot with the guest’s exit code. On the bare-metal path the exit code is the semihosting SYS_EXIT value (0 = success); see Machine.RunStatus.
output() 🔗
Output is the captured serial console output.
Return Type
String ! Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
run-status --timeout-seconds integer \
outputfunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, timeoutSeconds int) string {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Runstatus(timeoutSeconds).
Output(ctx)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, timeoutseconds: int) -> str:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.runstatus(timeoutseconds)
.output()
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, timeoutSeconds: number): Promise<string> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.runStatus(timeoutSeconds)
.output()
}exitCode() 🔗
ExitCode is the guest exit code (semihosting SYS_EXIT; 0 = success). A guest that doesn’t power off before the deadline is killed and yields the timeout code (124) — see runSerialStatus for why it isn’t the raw SIGKILL code (137).
Return Type
Integer ! Example
dagger -m github.com/z5labs/devex/daggerverse/qemu@a17bf411228ae3d544c7c18bcf08dd04c295d453 call \
linux --kernel file:path --machine string --cpu string --memory-mb integer --cmdline string --registry string --name string \
run-status --timeout-seconds integer \
exit-codefunc (m *MyModule) Example(ctx context.Context, kernel *dagger.File, arch , machine string, cpu string, memoryMb int, accel , cmdline string, registry string, name string, timeoutSeconds int) int {
return dag.
Qemu().
Linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name).
Runstatus(timeoutSeconds).
Exitcode(ctx)
}@function
async def example(kernel: dagger.File, arch: , machine: str, cpu: str, memorymb: int, accel: , cmdline: str, registry: str, name: str, timeoutseconds: int) -> int:
return await (
dag.qemu()
.linux(kernel, arch, machine, cpu, memorymb, accel, cmdline, registry, name)
.runstatus(timeoutseconds)
.exitcode()
)@func()
async example(kernel: File, arch: , machine: string, cpu: string, memoryMb: number, accel: , cmdline: string, registry: string, name: string, timeoutSeconds: number): Promise<number> {
return dag
.qemu()
.linux(kernel, arch, machine, cpu, memoryMb, accel, cmdline, registry, name)
.runStatus(timeoutSeconds)
.exitCode()
}