[Rpm-maint] [rpm-software-management/rpm] Add an alternative, enhanceable form of rpm.execute() with io redirect capabilities (PR #3236)
Miro Hrončok
notifications at github.com
Mon Aug 12 15:30:56 UTC 2024
@hroncok 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')
But if you don't like that, I consider `spawn` a good name for this function. It spawns a process, the name resembles `posix_spwan` but at the same time it isn't exactly `posix_spwan`, so I would not expect the same API as `posix_spwan`.
--
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3236#discussion_r1713996358
You are receiving this because you are subscribed to this thread.
Message ID: <rpm-software-management/rpm/pull/3236/review/2233392170 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240812/e77ae5ae/attachment.html>
More information about the Rpm-maint
mailing list