Skip to content

Commit

Permalink
compilers: Allow setting workdir for run checks
Browse files Browse the repository at this point in the history
This is not exposed in API, but will be used internally.
  • Loading branch information
xclaesse committed Nov 24, 2023
1 parent b708eaf commit d14a241
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mesonbuild/compilers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,8 @@ def has_header_symbol(self, hname: str, symbol: str, prefix: str,

def run(self, code: 'mesonlib.FileOrString', env: 'Environment', *,
extra_args: T.Union[T.List[str], T.Callable[[CompileCheckMode], T.List[str]], None] = None,
dependencies: T.Optional[T.List['Dependency']] = None) -> RunResult:
dependencies: T.Optional[T.List['Dependency']] = None,
run_cwd: T.Optional[str] = None) -> RunResult:
need_exe_wrapper = env.need_exe_wrapper(self.for_machine)
if need_exe_wrapper and self.exe_wrapper is None:
raise CrossNoRunException('Can not run test applications in this cross environment.')
Expand All @@ -730,7 +731,7 @@ def run(self, code: 'mesonlib.FileOrString', env: 'Environment', *,
else:
cmdlist = [p.output_name]
try:
pe, so, se = mesonlib.Popen_safe(cmdlist)
pe, so, se = mesonlib.Popen_safe(cmdlist, cwd=run_cwd)
except Exception as e:
mlog.debug(f'Could not run: {cmdlist} (error: {e})\n')
return RunResult(False)
Expand Down

0 comments on commit d14a241

Please sign in to comment.