Skip to content

Commit 586898d

Browse files
committed
Handle case of empty version string command result
1 parent 4f6440a commit 586898d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

yggdrasil/drivers/CompiledModelDriver.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5384,8 +5384,8 @@ def get_executable_command(cls, args, skip_flags=False,
53845384
# Form command
53855385
if executable is None:
53865386
executable = cls.get_executable(full_path=True, cfg=cfg)
5387-
cmd = flags + args + library_flags
5388-
cmd = [executable] + cmd
5387+
cmd = [x for x in (flags + args + library_flags) if x]
5388+
cmd = [executable] + cls.fix_flags(cmd, context='cmd')
53895389
if use_ccache and shutil.which('ccache'):
53905390
cmd = ['ccache'] + cmd
53915391
# Pop library flags so it is not an unused_kwarg in cases of
@@ -5653,7 +5653,7 @@ def format_out(name, x, indent=2, wrap=100, tab=' ',
56535653
try:
56545654
if (not skip_flags) and ('env' not in unused_kwargs):
56555655
unused_kwargs['env'] = cls.set_env()
5656-
cmd = cls.fix_flags(cmd, context='cmd')
5656+
# cmd = cls.fix_flags(cmd, context='cmd')
56575657
message_before = (
56585658
format_out('Working Dir', working_dir)
56595659
+ format_out('Raw Command',
@@ -7028,7 +7028,10 @@ def language_version(cls, toolname=None, **kwargs):
70287028
70297029
"""
70307030
basetool = cls.get_tool('basetool', toolname=toolname)
7031-
return basetool.tool_version(**kwargs).splitlines()[0].strip()
7031+
out = basetool.tool_version(**kwargs).splitlines()
7032+
if not out:
7033+
return ''
7034+
return out[0].strip()
70327035

70337036
def run_model(self, **kwargs):
70347037
r"""Run the model. Unless overridden, the model will be run using

0 commit comments

Comments
 (0)