From 141cf9c11f9472584bee792e42d0b6fe5eddd442 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 26 Nov 2025 20:41:47 +0100 Subject: [PATCH] vircommand: Update documentation to virCommandSetDryRun() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/util/vircommand.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 * -- 2.47.3