Skip to content

Commit

Permalink
Merge pull request #747 from douglasjacobsen/command-runner-path
Browse files Browse the repository at this point in the history
Allow command runners to be given an alternative path
  • Loading branch information
linsword13 authored Nov 6, 2024
2 parents 88834df + 5ec1e29 commit 83268da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ramble/ramble/util/command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CommandRunner:
Can be inherited to construct custom command runners.
"""

def __init__(self, name=None, command=None, shell="bash", dry_run=False):
def __init__(self, name=None, command=None, shell="bash", dry_run=False, path=None):
"""
Ensure required command is found in the path
"""
Expand All @@ -29,7 +29,10 @@ def __init__(self, name=None, command=None, shell="bash", dry_run=False):
self.shell = shell
required = not self.dry_run
try:
self.command = which(command, required=required)
if path is None:
self.command = which(command, required=required)
else:
self.command = which(command, required=required, path=path)
except CommandNotFoundError:
raise RunnerError(f"Command {name} is not found in path")

Expand Down

0 comments on commit 83268da

Please sign in to comment.