Skip to content

Commit

Permalink
send in PATH as well as PYTHONPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Feb 27, 2024
1 parent c5be197 commit f212dc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/integration/pping_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def get_root_method():
if os.geteuid() == 0:
return []
elif os.system("sudo true") == 0:
os_path = os.environ.get("PATH", "")
if not str(BINDIR) in os_path:
os_path = str(BINDIR) + ':' + os_path
print("get_root_method PYTHONPATH:")
for piece in sys.path:
print(piece)
Expand All @@ -88,7 +91,7 @@ def get_root_method():
print("get_root_method PYTHONPATH shown to sudo:")
for piece in pythonpath.split(":"):
print(piece if piece else "EMPTY STRING")
return ["sudo", "-E", "PYTHONPATH=%s" % pythonpath]
return ["sudo", "-E", "PYTHONPATH=%s PATH=%s" % (pythonpath, os_path)]
elif os.system("gosu root true") == 0:
return ["gosu", "root"]
else:
Expand Down

0 comments on commit f212dc8

Please sign in to comment.