问题
如何捕获命令的标准输出流?
目标
学习如何从工具中捕获流输出。
要捕获工具的标准输出流,请添加带有输出流所在文件名称的stdout字段。然后在相应的输出参数上添加type: stdout。
stdout.cwl
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
stdout: output.txt
inputs:
message:
type: string
inputBinding:
position: 1
outputs:
example_out:
type: stdout
echo-job.yml
message: Hello world!
现在用命令cwl-runner调用输入对象:
$ cwl-runner stdout.cwl echo-job.yml
[job stdout.cwl] /tmp/tmpE0gTz7$ echo \
'Hello world!' > /tmp/tmpE0gTz7/output.txt
[job stdout.cwl] completed success
{
"example_out": {
"location": "file:///home/me/cwl/user_guide/output.txt",
"basename": "output.txt",
"class": "File",
"checksum": "sha1$47a013e660d408619d894b20806b1d5086aab03b",
"size": 13,
"path": "/home/me/cwl/user_guide/output.txt"
}
}
Final process status is success