diff --git a/src/toil/wdl/wdltoil.py b/src/toil/wdl/wdltoil.py index 3166ec1bbf..44aec641fc 100755 --- a/src/toil/wdl/wdltoil.py +++ b/src/toil/wdl/wdltoil.py @@ -48,7 +48,7 @@ import WDL.Error import WDL.runtime.config from configargparse import ArgParser, SUPPRESS -from WDL._util import byte_size_units +from WDL._util import byte_size_units, strip_leading_whitespace from WDL.CLI import print_error from WDL.runtime.backend.docker_swarm import SwarmContainer from WDL.runtime.backend.singularity import SingularityContainer @@ -1638,9 +1638,12 @@ def patched_run_invocation(*args: Any, **kwargs: Any) -> List[str]: # Make a new standard library for evaluating the command specifically, which only deals with in-container paths and out-of-container paths. command_library = ToilWDLStdLibTaskCommand(file_store, task_container) + + # Work around wrong types from MiniWDL. See + dedent = cast(Callable[[str], Tuple[int, str]], strip_leading_whitespace) # Work out the command string, and unwrap it - command_string: str = evaluate_named_expression(self._task, "command", WDL.Type.String(), self._task.command, contained_bindings, command_library).coerce(WDL.Type.String()).value + command_string: str = dedent(evaluate_named_expression(self._task, "command", WDL.Type.String(), self._task.command, contained_bindings, command_library).coerce(WDL.Type.String()).value)[1] # Grab the standard out and error paths. MyPy complains if we call # them because in the current MiniWDL version they are untyped.