Properly drop back into a su'ed command

feature/node-rewrite
Sven Slootweg 12 years ago
parent 0c3809e818
commit ab4bcae1d9

@ -16,7 +16,7 @@ logfile = open("/etc/cvm/log/log.%s" % rand, "w")
logfile.write("# NON-INTERACTIVE COMMAND EXECUTION\n") logfile.write("# NON-INTERACTIVE COMMAND EXECUTION\n")
logfile.write("$ " + command + "\n") logfile.write("$ " + command + "\n")
prc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) prc = subprocess.Popen(["su", "-s", "/bin/bash", "-c", command, "cvm"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while prc.poll() is None: while prc.poll() is None:
stdout = prc.stdout.read() stdout = prc.stdout.read()

Loading…
Cancel
Save