[Rpm-maint] [rpm-software-management/rpm] rpm --eval "%{lua:rpm.interactive()}" does not immediately print the output (#1215)

Miro Hrončok notifications at github.com
Thu May 14 08:13:09 UTC 2020


I meant something a bit more sophisticated. I have so far:

```python
#!/usr/bin/python3
import sys
from ctypes import cdll, c_char_p


librpmio = cdll.LoadLibrary("librpmio.so.9")

adjust_path = b"""
if os.getenv("LUA_PATH") then
    package.path =  os.getenv("LUA_PATH") .. ";" .. package.path
end
"""

# first argument is an "rpmlua" pointer, but uses global one when NULL
# second argument is code
# third argument is "name", used in errors, reasonable default when NULL
librpmio.rpmluaRunScript(None, c_char_p(adjust_path), None)

if len(sys.argv) > 1:
    sys.argv[-1] = '/dev/stdin' if sys.argv[-1] == '-' else sys.argv[-1]
    # first argument as above, second argument is path
    librpmio.rpmluaRunScriptFile(None, c_char_p(sys.argv[-1].encode("utf-8")))
else:
    librpmio.rpmluaRunScript(None, c_char_p(b"rpm.interactive()"), None)
```

-- 
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/issues/1215#issuecomment-628471186
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200514/847070de/attachment-0001.html>


More information about the Rpm-maint mailing list