Skip to content

Commit

Permalink
Explicitly set pythonpath for sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Nov 21, 2023
1 parent 4ed6a0d commit aae3871
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/integration/pping_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
various pping integration tests
"""
import os
import sys
from pathlib import Path
import getpass
from shutil import which
Expand Down Expand Up @@ -76,7 +77,8 @@ def get_root_method():
if os.geteuid() == 0:
return []
elif os.system("sudo true") == 0:
return ["sudo", "-E"]
pythonpath = ":".join(sys.path)
return ["sudo", "-E", "PYTHONPATH=%s" % pythonpath]
elif os.system("gosu root true") == 0:
return ["gosu", "root"]
else:
Expand Down

0 comments on commit aae3871

Please sign in to comment.