common-workflow-language / common-workflow-language/cwltool

Improper dumping destination of `--make-template`

Open
#1,312 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.