1. 问题
    2. 如何捕获命令的标准输出流?
    3. 目标
    4. 学习如何从工具中捕获流输出。

    要捕获工具的标准输出流,请添加带有输出流所在文件名称的stdout字段。然后在相应的输出参数上添加type: stdout。
    stdout.cwl

    1. #!/usr/bin/env cwl-runner
    2. cwlVersion: v1.0
    3. class: CommandLineTool
    4. baseCommand: echo
    5. stdout: output.txt
    6. inputs:
    7. message:
    8. type: string
    9. inputBinding:
    10. position: 1
    11. outputs:
    12. example_out:
    13. type: stdout

    echo-job.yml

    1. message: Hello world!

    现在用命令cwl-runner调用输入对象:

    1. $ cwl-runner stdout.cwl echo-job.yml
    2. [job stdout.cwl] /tmp/tmpE0gTz7$ echo \
    3. 'Hello world!' > /tmp/tmpE0gTz7/output.txt
    4. [job stdout.cwl] completed success
    5. {
    6. "example_out": {
    7. "location": "file:///home/me/cwl/user_guide/output.txt",
    8. "basename": "output.txt",
    9. "class": "File",
    10. "checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b",
    11. "size": 13,
    12. "path": "/home/me/cwl/user_guide/output.txt"
    13. }
    14. }
    15. Final process status is success