Skip to content

Commit 50dfc6b

Browse files
kinowmr-c
authored andcommitted
Add new test for chained commands, update the specification wording
1 parent 29385c0 commit 50dfc6b

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

CommandLineTool.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ $graph:
567567
stdout: random_stdout_filenameABCDEFG
568568
```
569569
570+
If the `CommandLineTool` contains logically chained commands
571+
(e.g. `echo a && echo b`) `stdout` must include the output of
572+
every command.
573+
570574
571575
- name: stderr
572576
type: enum
@@ -700,6 +704,10 @@ $graph:
700704
Capture the command's standard output stream to a file written to
701705
the designated output directory.
702706
707+
If the `CommandLineTool` contains logically chained commands
708+
(e.g. `echo a && echo b`) `stdout` must include the output of
709+
every command.
710+
703711
If `stdout` is a string, it specifies the file name to use.
704712
705713
If `stdout` is an expression, the expression is evaluated and must
@@ -1105,8 +1113,8 @@ $graph:
11051113
extends: ProcessRequirement
11061114
doc: |
11071115
Modify the behavior of CommandLineTool to generate a single string
1108-
containing a shell command line. Each item in the argument list must be
1109-
joined into a string separated by single spaces and quoted to prevent
1116+
containing a shell command line. Each item in the `arguments` list must
1117+
be joined into a string separated by single spaces and quoted to prevent
11101118
intepretation by the shell, unless `CommandLineBinding` for that argument
11111119
contains `shellQuote: false`. If `shellQuote: false` is specified, the
11121120
argument is joined into the command string without quoting, which allows

conformance_tests.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,3 +3540,16 @@
35403540
doc: |
35413541
Use of $(runtime.outdir) for outputBinding glob.
35423542
tags: [ required, command_line_tool ]
3543+
3544+
- label: stdout_chained_commands
3545+
output: {
3546+
"out": "a\nb\n"
3547+
}
3548+
tool: tests/stdout_chained_commands.cwl
3549+
doc: |
3550+
Test that chaining two echo calls causes the workflow tool to emit the output to stdout.
3551+
This is to confirm that the workflow tool will **not** create an expression such as
3552+
`echo a && echo b > out.txt`, but instead will produce the correct `echo a && echo b`,
3553+
and capture the output correctly.
3554+
tags: [ shell_command, command_line_tool ]
3555+

invocation.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ Once the command line is built and the runtime environment is created, the
132132
actual tool is executed.
133133

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

137141
Tools may be multithreaded or spawn child processes; however, when the
138142
parent process exits, the tool is considered finished regardless of whether

tests/stdout_chained_commands.cwl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cwlVersion: v1.2
2+
class: CommandLineTool
3+
requirements:
4+
- class: ShellCommandRequirement
5+
inputs: []
6+
outputs:
7+
out:
8+
type: string
9+
outputBinding:
10+
glob: out.txt
11+
loadContents: true
12+
outputEval: $(self[0].contents)
13+
stdout: out.txt
14+
arguments:
15+
- echo
16+
- a
17+
- {valueFrom: '&&', shellQuote: false}
18+
- echo
19+
- b

0 commit comments

Comments
 (0)