Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
docs(cli): state why -o exists, correctly this time
EtienneLescot4ff6d94b65f1
diff --git a/docs/cli.md b/docs/cli.mdindex 8eea3780d..4cc89dc79 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -95,12 +95,18 @@ openscreen sources --jsonopenscreen sources -o sources.json # straight to a file```-On a host with no D-Bus and no GPU — a container, a CI runner, a server —-Chromium and ANGLE write their own diagnostics to this process's stdout, ahead-of anything the CLI emits, and no Chromium switch silences all of them: some of-that output never passes through Chromium's logging at all. Piping `--json` into-a parser therefore fails in exactly the environments `--json` exists for. Pass-`-o <file>` there: the file is a channel nothing else can write to.+`--json` on stdout is the normal path and works: Chromium's own diagnostics go+to stderr, so a pipe carries only the CLI's output.++What the CLI cannot control is the wrapper around it. Ubuntu's `xvfb-run` — the+usual way to run a GUI binary on a headless machine — merges the command's+stderr into its stdout, and under it Chromium's startup complaints about D-Bus+and OpenGL arrive ahead of the JSON, so `openscreen sources --json | jq` fails.+Other launchers and log collectors do the same.++`-o <file>` writes the result somewhere no wrapper can redirect. It also avoids+shell quoting and encoding differences, which is worth more on Windows than on+POSIX.`--json` emits the payload on the final `done` event:diff --git a/electron/cli/args.ts b/electron/cli/args.tsindex 088c84d73..4b0ef67cd 100644--- a/electron/cli/args.ts+++ b/electron/cli/args.ts@@ -28,12 +28,18 @@ export type CliCommand = (/** Machine-readable NDJSON output on stdout instead of human progress. */json?: boolean;/**- * Write the machine-readable result here instead of trusting stdout with it.- * On a host without dbus or a GPU -- a container, a CI runner, a server --- * Chromium and ANGLE write diagnostics straight to the process's stdout, ahead- * of anything this CLI emits, and no Chromium switch reaches all of them: some- * of that output does not go through Chromium's logging at all. A file is the- * one channel nothing else can reach.+ * Write the machine-readable result here rather than onto stdout.+ *+ * stdout is correct as it stands -- Chromium logs to stderr, and nothing this+ * process runs writes anywhere it should not. What a caller cannot control is+ * the wrapper around it. Ubuntu's xvfb-run, which is how a GUI binary gets run+ * headlessly in the first place, folds the command's stderr into its stdout;+ * under it, `sources --json | jq` sees Chromium's diagnostics ahead of the JSON+ * and fails. That is not hypothetical -- it is what the first attempt to script+ * this command did.+ *+ * A named file is a channel no wrapper can redirect into. It also sidesteps+ * shell quoting and encoding, which matters more on Windows than on POSIX.*/jsonOutPath?: string;};diff --git a/electron/cli/cliMain.ts b/electron/cli/cliMain.tsindex bddc3cd42..cd1289e14 100644--- a/electron/cli/cliMain.ts+++ b/electron/cli/cliMain.ts@@ -428,11 +428,11 @@ export function runCli(command: CliCommand): void {if (result.success && command.kind === "captions" && result.projectData !== undefined) {await writeProjectFile(command.projectPath, result.projectData);}- // A file is the only output channel this process fully owns. Chromium- // and ANGLE write diagnostics straight to stdout on a host with no- // dbus and no GPU, ahead of anything emitted here, and no switch- // silences all of them -- part of that output never passes through- // Chromium's logging. So -o exists for the case stdout cannot serve.+ // -o writes where no wrapper can redirect. stdout itself is fine --+ // Chromium logs to stderr -- but a caller does not control what wraps+ // this process, and xvfb-run on Ubuntu merges the two, which is enough+ // to make `sources --json | jq` fail under the very tool used to run a+ // GUI binary headlessly.if (result.success &&command.kind === "sources" &&