工具在受限制的环境中运行,并且不从父进程继承大多数环境变量。您可以使用EnvVarRequirement为工具设置环境变量。
    env.cwl

    1. #!/usr/bin/env cwl-runner
    2. cwlVersion: v1.0
    3. class: CommandLineTool
    4. baseCommand: env
    5. requirements:
    6. EnvVarRequirement:
    7. envDef:
    8. HELLO: $(inputs.message)
    9. inputs:
    10. message: string
    11. outputs:
    12. example_out:
    13. type: stdout
    14. stdout: output.txt

    echo-job.yml

    1. message: Hello world!

    运行cwl-runner

    1. $ cwl-runner env.cwl echo-job.yml
    2. [job env.cwl] /home/example$ env > /home/example/output.txt
    3. [job env.cwl] completed success
    4. {
    5. "example_out": {
    6. "location": "file:///home/example/output.txt",
    7. "basename": "output.txt",
    8. "class": "File",
    9. "checksum": "sha1$1ca16a840b14807b2fd3323022c476b06a150e2f",
    10. "size": 94,
    11. "path": "/home/example/output.txt"
    12. }
    13. }
    14. Final process status is success
    15. $ cat output.txt
    16. HELLO=Hello world!
    17. PATH=/bin:/usr/bin:/usr/local/bin
    18. HOME=/home/example
    19. TMPDIR=/tmp/tmp63Obpk