Skip to content

Commit

Permalink
Clean up executable injection
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Jan 19, 2024
1 parent bccd03d commit 9a01c1f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions python/binharness/types/injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,26 @@ class ExecutableInjection(Injection):
environment.
"""

executable: Path
_executable: Path | None

def __init__(
self: ExecutableInjection,
executable: Path,
host_path: Path,
env_path: Path | None = None,
executable: Path | None = None,
) -> None:
"""Create an ExecutableInjection."""
super().__init__(host_path, env_path)
self.executable = executable
self._executable = executable

@property
def executable(self: ExecutableInjection) -> Path:
"""Return the executable path."""
if self.host_path is not None:
if self._executable is None:
return self.host_path
return self.host_path / self._executable
raise InjectionNotInstalledError

def run(
self: ExecutableInjection,
Expand All @@ -96,7 +105,7 @@ def run(
if self._environment is None or self.env_path is None:
raise InjectionNotInstalledError
return self._environment.run_command(
[self.env_path, *args],
[self.executable, *args],
env=env,
cwd=cwd,
)

0 comments on commit 9a01c1f

Please sign in to comment.