Skip to content

Commit

Permalink
Add bdsh workdir to virtenv path
Browse files Browse the repository at this point in the history
  • Loading branch information
logandhillon committed Jul 12, 2024
1 parent 0bb73ad commit d885486
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bdsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def __init__(self, stdout: callable, stdin: callable, **is_ssh: bool):
"ld": self.cmd_ld,
}

self.env = os.environ.copy()
self.env['PYTHONPATH'] = os.path.dirname(os.path.realpath(__file__))

def cmd_ld(self, args):
try:
self.print('\t'.join([item + '/' if os.path.isdir(os.path.join(self.get_path(args[1] if len(args) > 1 else ""), item)) else item for item in os.listdir(self.get_path(args[1] if len(args) > 1 else ""))]))
Expand All @@ -41,7 +44,7 @@ def run_line(self, line: str):
except Exception as e:
self.print(f"{args[0]}: {e}")
elif os.path.exists(bin := self.get_path("exec", args[0])):
subprocess.run([sys.executable, bin] + args[1:], stdout=sys.stdout, stderr=subprocess.STDOUT, text=True)
subprocess.run([sys.executable, bin] + args[1:], stdout=sys.stdout, stderr=subprocess.STDOUT, text=True, env=self.env)
else:
self.print(f"Invalid command: {args[0]}")

Expand Down

0 comments on commit d885486

Please sign in to comment.