Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CommandLineTool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ $graph:
stdout: random_stdout_filenameABCDEFG
```

If the `CommandLineTool` contains logically chained commands
(e.g. `echo a && echo b`) `stdout` must include the output of
every command.


- name: stderr
type: enum
Expand Down Expand Up @@ -700,6 +704,10 @@ $graph:
Capture the command's standard output stream to a file written to
the designated output directory.

If the `CommandLineTool` contains logically chained commands
(e.g. `echo a && echo b`) `stdout` must include the output of
every command.

If `stdout` is a string, it specifies the file name to use.

If `stdout` is an expression, the expression is evaluated and must
Expand Down Expand Up @@ -1105,8 +1113,8 @@ $graph:
extends: ProcessRequirement
doc: |
Modify the behavior of CommandLineTool to generate a single string
containing a shell command line. Each item in the argument list must be
joined into a string separated by single spaces and quoted to prevent
containing a shell command line. Each item in the `arguments` list must
be joined into a string separated by single spaces and quoted to prevent
intepretation by the shell, unless `CommandLineBinding` for that argument
contains `shellQuote: false`. If `shellQuote: false` is specified, the
argument is joined into the command string without quoting, which allows
Expand Down
13 changes: 13 additions & 0 deletions conformance_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3540,3 +3540,16 @@
doc: |
Use of $(runtime.outdir) for outputBinding glob.
tags: [ required, command_line_tool ]

- label: stdout_chained_commands
output: {
"out": "a\nb\n"
}
tool: tests/stdout_chained_commands.cwl
doc: |
Test that chaining two echo calls causes the workflow tool to emit the output to stdout.
This is to confirm that the workflow tool will **not** create an expression such as
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
and capture the output correctly.
tags: [ shell_command, command_line_tool ]

6 changes: 5 additions & 1 deletion invocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ Once the command line is built and the runtime environment is created, the
actual tool is executed.

The standard error stream and standard output stream may be captured by
platform logging facilities for storage and reporting.
platform logging facilities for storage and reporting. If there are multiple
commands logically chained (e.g. `echo a && echo b`) implementations must
capture the output of all the commands, and not only the output of the last
command (i.e. the following is incorrect `echo a && echo b > captured`,
as the output of `echo a` is not included in `captured`).

Tools may be multithreaded or spawn child processes; however, when the
parent process exits, the tool is considered finished regardless of whether
Expand Down
19 changes: 19 additions & 0 deletions tests/stdout_chained_commands.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cwlVersion: v1.2
class: CommandLineTool
requirements:
- class: ShellCommandRequirement
inputs: []
outputs:
out:
type: string
outputBinding:
glob: out.txt
loadContents: true
outputEval: $(self[0].contents)
stdout: out.txt
arguments:
- echo
- a
- {valueFrom: '&&', shellQuote: false}
- echo
- b