common-workflow-language / cwltool

Common Workflow Language reference implementation
https://cwltool.readthedocs.io/
Apache License 2.0
335 stars 230 forks source link

Improper dumping destination of `--make-template` #1312

Open suecharo opened 4 years ago

suecharo commented 4 years ago

I often import cwltool as a python package and run it as a python script.

Here's an example:

from cwltool.main import run as run_cwltool

run_cwltool(
    [wf_file_path]
    stdout=stdout_file_path.open(mode="w"),
    stderr=stderr_file_path.open(mode="w")
)

In this usage, when I run --make-template wf_file_path, I noticed that its result was dumped to sys.stdout.

run_cwltool(
    ["--make-template", wf_file_path]
    stdout=stdout_file_path.open(mode="w"),
    stderr=stderr_file_path.open(mode="w")
)

I think this part of the code is causing the problem. (It may not even be a problem because it's not supposed usage...)

https://github.com/common-workflow-language/cwltool/blob/84939620c3eec1ab11369849c63237ebfa48da41/cwltool/main.py#L730

tetron commented 4 years ago

Yes, that is a mistake, thank you for bringing it up. Could you make a pull request to fix it?

suecharo commented 4 years ago

@tetron Thanks for the response, Mr.Peter. I will try to make a PR to fix it. As a test, I can use these two below as a reference, right?

mr-c commented 4 years ago

@suecharo Yes, and the CWL conformance tests will automatically run when you open the PR. Thanks!