listener module
listener module¶
- listener.setuid(uid)[source]¶
Set the current process’s effective user id. Use
unsetuid()
to return to the listeners UID.When used with any other user than root. Be aware that
listener.unsetuid()
will not be possible afterwards, as that requires root privileges.
- listener.unsetuid()[source]¶
Return the current process’s effective user id to the listeners UID. Only possible if the current effective user id is root.
- Returns
None
- listener.run(exe, argv, uid=- 1, wait=True)[source]¶
Execute a the program exe with arguments argv and effective user id uid.
- Parameters
exe (str) – path to executable
uid (int) – effective user id the process should be started with
wait (bool) – if true will block until the process has finished and return either its exit code or the signal that lead to its stop (a negative number), see
os.P_WAIT
. If false will return as soon as the new process has been created, with the process id as the return value (seeos.P_NOWAIT
).
- Returns
exit code or signal number or process id
- Return type
Warning
Not waiting for the sub-process leads to zombie processes.