[Rpm-maint] [rpm] Add lua function posix.close (#44)

Zbigniew Jędrzejewski-Szmek notifications at github.com
Thu Jan 14 20:56:46 UTC 2016


This is useful to silence output in forked programs:
https://bugzilla.redhat.com/show_bug.cgi?id=1287918

Tested with the following scriptlet:
```
%post -p <lua>
pid = posix.fork()
if pid == 0 then
    assert(posix.exec("/bin/sed"))
elseif pid > 0 then
    posix.wait(pid)
end
pid = posix.fork()
if pid == 0 then
    posix.close(2)
    io.open("/dev/null")
    assert(posix.exec("/bin/awk"))
elseif pid > 0 then
    posix.wait(pid)
end
```

As expected, the error message from sed is printed, the error message
from awk is not.

You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/44

-- Commit Summary --

  * Add posix.close

-- File Changes --

    M luaext/lposix.c (8)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/44.patch
https://github.com/rpm-software-management/rpm/pull/44.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/44
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20160114/9117c456/attachment.html>


More information about the Rpm-maint mailing list