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
_______________________________________________
Rpm-maint mailing list
[email protected]
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to