[Rpm-maint] [rpm-software-management/rpm] lua: add posix.spawn() (#390)

Igor Gnatenko notifications at github.com
Tue Feb 6 13:51:29 UTC 2018


At this point, if you want to avoid using shell you have only option
which is to use posix.fork() and posix.exec() which is too verbose and
not optional (as Florian Weimer says, posix_spawn() can be implemented
more efficiently than usual fork() / execve() sequence).

Typical use-case is shown below.

-- Before
pid = posix.fork()
if pid == 0 then
  assert(posix.exec("/foo/bar"))
elseif pid > 0 then
  posix.wait(pid)
end
-- After
assert(posix.spawn("/foo/bar"))

Fixes: https://github.com/rpm-software-management/rpm/issues/389
Signed-off-by: Igor Gnatenko <i.gnatenko.brain at gmail.com>

---

And also fix small memory leak.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * lua: add posix.spawn()
  * lua: fix few memory leaks

-- File Changes --

    M luaext/lposix.c (61)

-- Patch Links --

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

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/390
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20180206/6ac4f661/attachment.html>


More information about the Rpm-maint mailing list