From: Michal Privoznik Date: Wed, 26 Nov 2025 19:41:47 +0000 (+0100) Subject: vircommand: Update documentation to virCommandSetDryRun() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=141cf9c11f9472584bee792e42d0b6fe5eddd442;p=thirdparty%2Flibvirt.git vircommand: Update documentation to virCommandSetDryRun() Throughout years, virCommandSetDryRun() has gained more functionality and arguments. But: 1) not all arguments are covered in documentation, 2) the example wouldn't even compile. Expand the documentation to reflect current behaviour. Signed-off-by: Michal Privoznik Tested-by: Jaroslav Suchanek Reviewed-by: Ján Tomko --- diff --git a/src/util/vircommand.c b/src/util/vircommand.c index d9e4c0181f..1390c80a32 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -3184,6 +3184,7 @@ virCommandDryRunTokenFree(virCommandDryRunToken *tok) * @bufArgLinebreaks: add linebreaks after command and every argument or argument pair * @bufCommandStripPath: strip leading paths of command * @callback: callback to process input/output/args + * @opaque: data blob to pass to @callback * * Sometimes it's desired to not actually run given command, but * see its string representation without having to change the @@ -3200,13 +3201,14 @@ virCommandDryRunTokenFree(virCommandDryRunToken *tok) * The strings stored in @buf are escaped for a shell and * separated by a newline. For example: * - * virBuffer buffer = VIR_BUFFER_INITIALIZER; - * virCommandSetDryRun(&buffer); - * + * g_auto(virBuffer) cmdbuf = VIR_BUFFER_INITIALIZER; + * g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); * virCommand *echocmd = virCommandNewArgList("/bin/echo", "Hello world", NULL); + * + * virCommandSetDryRun(dryRunToken, &cmdbuf, false, false, NULL, NULL); * virCommandRun(echocmd, NULL); * - * After this, the @buffer should contain: + * After this, the @cmdbuf should contain: * * /bin/echo 'Hello world'\n *