Suppose I call the su
command via python's os.system("su")
and after entering root mode I want python to execute a list of commands in this freshly entered root/superuser mode..how do I get a premature return value without exiting the root mode ?
Asked
Active
Viewed 47 times
0

metric-space
- 541
- 4
- 14
-
1You could use the `pexpect` module. – Blender Apr 24 '13 at 18:23
-
Alternatively use `subprocess.Popen` and check the stderr and stdout streams. – jmetz Apr 24 '13 at 18:24
-
@Blender am checking out the pexpect library ..looks promising. – metric-space Apr 24 '13 at 20:28