工具在受限制的环境中运行,并且不从父进程继承大多数环境变量。您可以使用EnvVarRequirement为工具设置环境变量。
env.cwl
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: CommandLineTool
baseCommand: env
requirements:
EnvVarRequirement:
envDef:
HELLO: $(inputs.message)
inputs:
message: string
outputs:
example_out:
type: stdout
stdout: output.txt
echo-job.yml
message: Hello world!
运行cwl-runner
$ cwl-runner env.cwl echo-job.yml
[job env.cwl] /home/example$ env > /home/example/output.txt
[job env.cwl] completed success
{
"example_out": {
"location": "file:///home/example/output.txt",
"basename": "output.txt",
"class": "File",
"checksum": "sha1$1ca16a840b14807b2fd3323022c476b06a150e2f",
"size": 94,
"path": "/home/example/output.txt"
}
}
Final process status is success
$ cat output.txt
HELLO=Hello world!
PATH=/bin:/usr/bin:/usr/local/bin
HOME=/home/example
TMPDIR=/tmp/tmp63Obpk