Skip to content

Commit 73e5295

Browse files
committed
expand stdin shortcut even when an ID is preset
1 parent 36432b7 commit 73e5295

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

cwltool/load_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _convert_stdstreams_to_files(
207207
else:
208208
workflowobj["stdin"] = (
209209
"$(inputs.%s.path)"
210-
% cast(str, inp["id"]).rpartition("#")[2]
210+
% cast(str, inp["id"]).rpartition("#")[2].split("/")[-1]
211211
)
212212
inp["type"] = "File"
213213
else:

tests/test_examples.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,18 @@ def test_bad_stdout_expr_error() -> None:
13031303
)
13041304

13051305

1306+
def test_stdin_with_id_preset() -> None:
1307+
"""Confirm that a type: stdin with a preset id does not give an error."""
1308+
error_code, _, stderr = get_main_output(
1309+
[
1310+
get_data("tests/wf/1590.cwl"),
1311+
"--file1",
1312+
get_data("tests/wf/whale.txt"),
1313+
]
1314+
)
1315+
assert error_code == 0
1316+
1317+
13061318
@needs_docker
13071319
@pytest.mark.parametrize("factor", test_factors)
13081320
def test_no_compute_chcksum(tmp_path: Path, factor: str) -> None:

tests/wf/1590.cwl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"baseCommand": [
3+
"cat"
4+
],
5+
"class": "CommandLineTool",
6+
"cwlVersion": "v1.2",
7+
"id": "cat-tool-shortcut.cwl",
8+
"inputs": [
9+
{
10+
"id": "file1",
11+
"type": "stdin"
12+
}
13+
],
14+
"outputs": [
15+
{
16+
"id": "output",
17+
"outputBinding": {
18+
"glob": "output"
19+
},
20+
"type": "File"
21+
}
22+
],
23+
"requirements": [
24+
{
25+
"class": "DockerRequirement",
26+
"dockerPull": "debian:stretch-slim"
27+
}
28+
],
29+
"stdout": "output"
30+
}

0 commit comments

Comments
 (0)