Skip to content

Demonstration how the `env` parameter of `subprocess.Popen` has no effect when using sudo.

Notifications You must be signed in to change notification settings

fonfon/popen-sudo-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Demonstration how the env parameter of subprocess.Popen has no effect when using sudo.

foo/run.py executes foo/runme with a changed PYTHONPATH so that foo/runme is able to import from bar.

Run it with:

cd foo
python3 run.py

Example output:

$ python3 run.py

Executing ['/home/fonfon/code/popen/foo/runme']:
Path of barfile.py: /home/fonfon/code/popen/bar/barfile.py

Executing ['sudo', '-E', '/home/fonfon/code/popen/foo/runme']:
Path of barfile.py: ImportError

About

Demonstration how the `env` parameter of `subprocess.Popen` has no effect when using sudo.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages