Python.Popen subprocess hide the real "dispaly name"

I want to execute a subprocess in python, and the subprocess needs an argument to specify a password. By default, anyone who can log into this machine can receive a password using the utility pswhen my subprocess is running.

And I know that Popen has a parameter __executable__that can hide the real name of the program, but cannot hide the subprocess password argument.

How to hide my password?

PS: I work on Linux.

+5
source share
2 answers

I don't think you can do this for a subprocess, but there is a library to do this from a subprocess: http://code.google.com/p/py-setproctitle/

; . , (, stdin pipe).

+1

subprocess API . :

subprocess.check_call('command --password="$PASSWORD"', shell=True,
                      env=dict(os.environ, PASSWORD=password))
+1

All Articles