| Server IP : 107.13.46.68 / Your IP : 216.73.216.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /bin/ |
Upload File : |
#!/usr/bin/python3
""" Runs a command and then passes the output to Cinnamon via DBus asynchronously
Usage: cinnamon-subprocess-wrapper ls ~/
"""
import subprocess
import sys
from setproctitle import setproctitle
from gi.repository import GLib, Gio
if __name__ == "__main__":
setproctitle("cinnamon-subprocess-wrapper")
process_id = int(sys.argv[1])
try:
result = subprocess.check_output(sys.argv[2:])
success = True
except Exception:
result = b''
success = False
try:
connection = Gio.bus_get_sync(Gio.BusType.SESSION, None)
connection.call_sync("org.Cinnamon",
"/org/Cinnamon",
"org.Cinnamon",
"PushSubprocessResult",
GLib.Variant("(isb)", (process_id, result.decode(errors="replace"), success)),
None,
Gio.DBusCallFlags.NONE,
2000,
None)
except GLib.Error as e:
print("Could not send response (ID: %d): %s" % (process_id, e.message))