Hello,
is there an equivalent in the subprocess module for "os.execvp()" to
replace the current process with the new called one?
is there an equivalent in the subprocess module for "os.execvp()" to
replace the current process with the new called one?
On Python for Windows what is the appropriate way how a process can call itself again?
Let me give you an example [1]:
There is a project "bitcli" having two entry points
[project.scripts]
bitcli = "bitcli.__main__:main"
bitcli-root = "bitcli.__main__:run_main_as_root_via_policykit"
The first is usual.
But the second does call "bitcli" via "pkexec" to give it some root
rights.
This application is intended to be run as user or root by the user
himself.
def run_main_as_root_via_policykit():
cmd = ['pkexec', '--disable-internal-agent', 'bitcli']
# See https://github.com/python/cpython/issues/39569
os.execvp(cmd[0], cmd)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 62:23:19 |
Calls: | 6,712 |
Files: | 12,244 |
Messages: | 5,355,896 |