Created
August 21, 2024 19:14
-
-
Save FRex/7e93fe0f71580bd5781408fd639d9c1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
import sys | |
import os | |
dirs = os.environ["PATH"].split(os.pathsep) | |
ourdir = os.path.dirname(__file__) | |
while dirs[0] != ourdir: | |
dirs.pop(0) | |
for d in dirs: | |
# print(d) | |
pass | |
print(sys.argv) | |
env = os.environ.copy() | |
env["PATH"] = os.pathsep.join(dirs) | |
args = list(sys.argv) | |
args[0] = os.path.basename(sys.argv[0]) | |
result = subprocess.run(args, env=env, check=False) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment