Products › lamco-dsi-tools › Docs › Output and exit codes

Output and exit codes

The JSON output of each command, the exit codes, and the JUnit report for CI.

The three programs of lamco-dsi-tools (DSI: Desktop session interfaces) use one JSON form and a small set of exit codes, so that they compose in shell scripts and automated checks. This page condenses docs/reference/json-output.md and lists every exit code from docs/reference/exit-codes.md.

Global flags

dsisee and dsido take the same flags, before or after the command:

  • --json: JSON on standard output in place of text.
  • --verbose: Debug logging on standard error.
  • --timeout <seconds>: A limit on the command's working time (default 30, 0 for none). It doesn't cover the window a command was asked to keep open with --duration, nor a wait for a permission dialog. A command that the limit, Ctrl-C or a termination signal ends while it records writes the capture of what it had, with the dissector marked cut_short_by, and exits 2, 130 or 143.
  • --junit <file>: Writes a JUnit XML file with one test case, which fails when the command fails.
  • --out <file>: Writes the command's capture to a file. A file named with --out is written before anything goes to standard output.

The commands that open a permission dialog (eis probe, eis observe, observe --allow-dialogs, check --allow-dialogs, dsido eis inject and the other portal routes) take --dialog-timeout <seconds> (default 120, 0 for none). That wait is measured and reported, and kept out of the working time --timeout limits.

dsitell takes --json. It has no time limit, since it reads files. Its --junit belongs to health and compare.

JSON output

Every command of the three programs takes --json and then prints one JSON document on standard output in place of text. Every document has schema_version as its first member, currently v1. A member that's added later doesn't change the version, so a reader has to pass over members it doesn't know.

dsisee and dsido

Every dsisee and dsido command prints a capture: The header, the environment, each dissector's outcome and the records (see The capture file). Most commands add a summary member beside the records, holding what the command worked out from them. A summary is the command's reading of its own records. It's never in their place, and dsitell doesn't read it.

Commandsummary holds
portal diagnose, portal probeCounts: Whether the frontend has an owner, a start the instrument made, interfaces, backends by source, the RemoteDesktop version, owner changes.
pipewire diagnose, pipewire probeThe daemon's version and the nodes; the driver cycle timing.
wayland diagnose, wayland protocolsThe compositor a version method was used for; the classification of the globals, marked as an interpretation.
eis diagnose, eis probeThe level the built-in table assumes, with its label; the life of the libei connection (phases, dialog_wait_ns, reached, devices, ready_sent, closure and more).
capture probe, capture observeroute (protocol, mechanism_id, chosen_because) and the frame timing. With --read-markers, markers; with --cursor-mode metadata, cursor; with --window or --cursor, those members.
input routes, clipboard routesThe input or clipboard function of the health summary.
input witnessWhat reached the window: Events by kind, focus, commits, marked_commits, presentation_clock_id.
clipboard observeroute, selections, reads (each with bytes, sha256, complete and three times), and two distributions.
output observeoutputs_described (each output as each interface describes it) and the outputs function.
audio observe, audio streamaudio_described and xrun_count; stream and the markers heard.
session remote-desktopnames, exported, differs_from_draft and draft (the address, commit and date the comparison was made against).
session logind, eis observe, input capture, observeNone. The document is the capture.
checkA health member in place of summary.
dsido inject and replayroute, action, typed and skipped, the steps planned and sent, keymap, request_to_sent, and where they apply witness_wait, device, before_first_step, touch_placing, dialog_wait_ns, replay_of.
dsido clipboard set, output set, audio play, screen animate, loadWhat was set, changed and restored, played, presented, or loaded. input-capture enable adds none.

With --soak, the commands that take it write the capture to --out as a stream, and the document on standard output says what the run came to: The file, how it ended, the records and bytes written, and the size cap.

dsitell

Each dsitell command prints a document of its own. The ones a script most often reads:

  • health: One summary per capture under captures, each with overall (the worst examined state, and counts of not_examined and assumed), functions (always eight, in order, each with state, statements and routes), also_looked_for and findings. A statement's records are indexes into the capture's records.
  • timing: clock, captures, durations (each with name, count, min_ns, median_ns, p95_ns, p99_ns, max_ns, jitter_ns, clock, basis and waits_for_person), rates (always estimated) and refused (durations across two clocks). Percentiles use the nearest rank, and jitter_ns is the population standard deviation. With --series, one figure over time: whole, over, longest, buckets, rate, span, stream and, where the capture holds a watch, session.
  • compare: fail_on and failing (the exit code is 1 exactly when failing is true), baseline and candidate, clocks, and sections environment, dissectors, advertised, portal_capabilities, health, findings, timing, portal_start, timing_refused, timing_policy and regressions. Every section holds every row, and differs or change says which differ.
  • matrix: columns, then health, findings and timing rows with one entry per column.
  • loop, glass, clipboard, audio: The two or three files, clock, closed (which is also the exit code), the pairs, and the distributions. A figure with two clock names carries one_clock and rests_on when it was computed, and is under not_computed otherwise.
  • bundle, scrub: The file or directory written, and redaction: replaced (always fifteen kinds, and a sixteenth with --redact-app-ids), left_inside_longer_words and kept.
  • replay: Per capture, who wrote and who reads it, mechanisms, against_stored, health and timing.
  • findings: The catalog, or one entry.

Errors

When a command fails in JSON mode, the message goes to standard error and standard output carries an error object:

{ "schema_version": "v1", "error": { "kind": "not_available", "message": "..." } }
Programkind
dsisee, dsidonot_available (the thing asked for isn't on this machine), refused (it's there and declined, for example a dialog that was declined), failed or timed_out. When a D-Bus peer answered with an error, the object also has bus_error with its name and message.
dsitellunreadable, not_a_capture, unknown_schema_version, clock_mismatch (timing was given captures that can't be combined), output (a file or standard output couldn't be written) or usage.

When a command that records is ended by its limit or a signal, the capture is the only document on standard output: No error object follows it. When a dsido injector falls short, the capture is still the document, with the injector's outcome in dissectors. A command line that can't be parsed is reported by the argument parser on standard error, with no JSON object.

Exit codes of dsisee and dsido

CodeMeaning
0The command ran.
1The command failed: What it reads isn't there, it was refused, or it went wrong.
2A time limit ran out (--timeout, or --dialog-timeout for a command that opens a dialog), or the command line couldn't be parsed.
130, 143An interrupt (SIGINT, which Ctrl-C sends) or a termination signal (SIGTERM) ended a command that was recording. Its capture is written first.
141The reader of standard output closed the pipe, as | head does. Nothing is printed on standard error.

Cases worth knowing:

  • dsisee observe and dsisee check exit 0 once they've written the capture, whatever is in it. A dissector that failed is an outcome in the capture, and a function check reports as broken is a line in its summary: dsisee judges nothing. They exit 2 when --timeout runs out, after writing what finished. For an exit code that follows the health summary, run dsitell health on the capture.
  • A command that's the front of a single dissector, such as dsisee portal diagnose, exits 1 when that dissector couldn't do its work. One that records for a window and fell short after recording something writes the capture of that, then exits 1.
  • A command that opens a portal session writes its capture from its first step on. When a step fails, is declined or isn't answered, the capture holds the steps and a session_fault record, and the command exits 1 or 2 as the fault says. A declined dialog is refused (1), and one not answered within --dialog-timeout is timed_out (2).
  • dsisee capture probe and capture observe exit 1, as not_available, when no capture route can be taken, or the portal is the only one and neither --allow-dialogs nor --route portal was given. In a build without the pipewire feature, capture probe also exits 1 whenever its route is the portal, before any dialog. With the feature, it exits 1 through the portal when no buffer arrived.
  • dsisee clipboard observe and dsido clipboard set exit 1, as not_available, when no clipboard route can be taken. clipboard set through the portal exits 1, as refused, when the portal starts the session with the clipboard not enabled.
  • A command that connects to the Wayland display gives the compositor ten seconds for each round trip it sets itself up with. One that isn't answered is recorded as round_trip_unanswered, and a command whose one job that was exits 2.
  • A dsido action that isn't well formed exits 2 before anything is opened. An injection that fell short exits 1, or 2 for a time limit, after writing its capture. A touch with no touchscreen exits 1, as not available (always on wlr). With no libei device resumed at all in ten seconds it's a time-out, 2.
  • dsido <route> replay exits 2 before anything is opened for a file that isn't a capture, holds no injection, or holds more than one action. Otherwise it exits as the route's inject does.
  • dsido <route> inject --wait-witness exits 1 when no witness said it had the focus in time. Nothing was sent.
  • dsido output set exits 2 for no change or one that isn't well formed. It exits 1 as not_available (no interface, no such output, mode or scale, or --test-only on KWin), as refused (the test said no, KWin answered the apply with failed, or GNOME's interface isn't as expected), or as failed (a tested change wasn't taken, or the prior state couldn't be put back). It exits 2 when the desktop didn't answer a configuration within ten seconds. Ended by a limit or a signal, it still applies the prior state before it returns, and never exits 0.
  • dsisee audio stream exits 1, after writing its capture, when no buffer arrived or fewer markers were heard than --expect named. dsido audio play exits 1 when its stream failed or the graph didn't ask for the run's buffers. Without the pipewire feature both exit 1 as not available and write no capture.
  • dsido session inhibit exits 0 when at least one of its two interfaces gave a lock and it was held for the time asked, and 1 when neither did. That the session locked all the same changes no exit code: It's SOAK-006.
  • A command that opens a portal session exits 2 when --persist is given without --restore-token, or --restore-token names a file with no token and --persist asks for none. The capture commands exit 1 when --persist, --restore-token or --session is given and the route isn't the portal's.
  • A run with --soak exits 1 when its file reached --soak-cap or couldn't be written, 0 when it lasted the time asked, and 2, 130 or 143 when a limit or signal ended it. --soak without --out exits 1 before anything is opened. A run killed outright has no exit code of its own.
  • dsisee capture observe --until-file <path> exits 0 when something appears at the path. Something already there when the command starts exits 1 before anything is opened.

Exit codes of dsido-uinput

CodeMeaning
0Done.
1Failed.
2Not a request the helper takes, or an argument.
3Refused: The helper may not open the node as the user it runs as, or it was started set-user-ID or set-group-ID.
4No uinput here: /dev/uinput doesn't exist.

Exit codes of dsitell

CodeMeaning
0The command ran. For health: No examined function is broken. For loop: Every injected step a window can see was seen by the witness. For glass: Every frame that was to be captured was. For clipboard: The content that was set came back whole. For audio: Every marker played was heard. For compare: No class named with --fail-on has a regression, which is always so when none is named.
1health: An examined function is broken, or absent with --fail-on-absent. loop: A step wasn't seen, or the injection holds no step a window can see. glass: A presented frame was dropped by the capture route or is in doubt, no frame was captured, or a step didn't reach the pixels. clipboard: No read of the watcher is the content that was set. audio: A marker played wasn't heard, or none was played. compare: The candidate regresses in a class named with --fail-on.
2A file isn't a capture, has a schema version this build doesn't read, couldn't be read, or an output file couldn't be written; captures given to timing, or to a loop command, don't name one machine and one boot; findings was asked for an identifier not in the catalog; scrub found no capture or would overwrite a file; replay --out was given several captures; timing --series was given an unknown figure, several captures or --bucket 0; or the command line couldn't be parsed.
141The reader of standard output closed the pipe.

matrix, replay, timing, bundle and findings have no failing verdict: They exit 0 when they wrote their output and 2 otherwise. A replay that reads a capture otherwise than a stored reading did says so and exits 0. Differences alone never change the exit code of compare.

health

The exit code follows the states of the functions that were examined, and nothing else. Findings don't set it.

StateExit codeWith --fail-on-absent
working, present00
absent01
broken11
not_examined, assumed00

absent isn't a failure by default because what a desktop doesn't have is often its design. A portal nobody has called yet is not_examined, not absent, so --fail-on-absent doesn't fail on it. Given several captures, health exits 1 when any has a failing function.

dsisee observe --out capture.json
dsitell health --fail-on-absent --junit health.xml capture.json || exit 1

JUnit reports

dsitell health --junit <file> writes one test case per function (named after its capture too when there are several):

StateTest case
working, presentPassed
absentPassed, or failed with --fail-on-absent
brokenFailed
not_examined, assumedSkipped, with the reason as its message

dsitell compare --junit <file> writes one test case per class of regression, five in all:

The classTest case
Was named with --fail-on and has a regressionFailed, with each regression in the message
Was named with --fail-on and has nonePassed
Wasn't named with --fail-onSkipped, with how many regressions were found and which
Had nothing to compareSkipped, whether or not it was named

A class that wasn't asked for, or that had nothing under it, is never reported as a pass. dsisee --junit <file> and dsido --junit <file> write one test case for the command, which fails when the command does.