2011-03-19, 18:32
Hello.
I want to do do simple thing. I need to execute "echo pass | sudo -S echo" and get return code. It working in a script started from shell but it not working if i use the same code in the plugin.
With this code I get such error. OSError 10: No child processes
I want to do do simple thing. I need to execute "echo pass | sudo -S echo" and get return code. It working in a script started from shell but it not working if i use the same code in the plugin.
Quote: p = subprocess.Popen(["sudo", "-S", "echo"], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdin = p.stdin
stdout = p.stdout
stderr = p.stderr
p.communicate("%s\n" % aPassword)
try :
if (p.poll() == None) :
p.wait()
except :
pass
With this code I get such error. OSError 10: No child processes