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

Zbigniew Jędrzejewski-Szmek notifications at github.com
Wed Mar 2 19:29:52 UTC 2016


OK, so... I could add `open` and `dup2`. But maybe a better option is to add a higher level call like `util.close_stderr` that would do
```
   if (!have_forked)
	return luaL_error(L, "exec not permitted in this context");
   fd = open('/dev/null', 'w');
   if (fd == 2)
       return pushresult(L, 0, NULL);
   return pushresult(L, dup2(fd, 2), NULL);
```
and similar for `util.close_stdout`. This should be easy to use in scriptlets and hard to abuse.

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


More information about the Rpm-maint mailing list