[Rpm-maint] [rpm-software-management/rpm] Add an alternative, enhanceable form of rpm.execute() with io redirect capabilities (PR #3236)

Florian Weimer notifications at github.com
Fri Aug 9 13:51:33 UTC 2024


@fweimer-rh commented on this pull request.



> +#### execute({table} [, stdout [, stderr]])
+
+Execute an external command (rpm >= 4.20)
+This is an alternative form of rpm.execute() that takes the command and any
+arguments as a single Lua table.
+
+Standard output and/or error can be optionally redirected to named path,
+such as commonly `/dev/null` to suppress output.
+
+```
+rpm.execute({'ls', '-l', '/''})
+```
+
+Redirect standard error to `/dev/null`:
+```
+rpm.execute({'systemctl', 'restart', 'httpd'}, nil, '/dev/null')

I don't want to bikeshead this, but I would have expected it the other way round, like this:

```lua
rpm.execute({redirect_stderr='/dev/null'}, 'systemctl', 'restart', 'httpd')
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3236#pullrequestreview-2230259129
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3236/review/2230259129 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240809/5423164e/attachment-0001.html>


More information about the Rpm-maint mailing list