Connect path output (from a tool stdout) to a File input

I have a tool which outputs to stdout a path, e.g. /my/file.txt and another tool which requires a file. How can i connect one to the other ?

The first tool has in its cwl definition:

    type: stdout
stdout: path_inside.txt 

So cat path_inside.txt would give /my/file.txt.

And the second tool has in its cwl definition:

    type: File
      prefix: --in_file

for which i’d like the argument of --in_file to be /my/file.txt.

What would be the most elegant way to connect the two in a workflow while preserving the tools definition ?

Hello @neurorepro and welcome.

In § 5.2.1 “stdout” in the CWL v1.0 CommandLineTool standard we learn that stdout is a shortcut for type: File with some additional properties.

So your example is equivalent to

    type: File
    streamable: true
      glob:  path_inside.txt 
stdout: path_inside.txt 

So you have an output of type File and an input of type File. These can be directly connected at the Workflow level with no changes needed.

Many thanks @mrc , and my apologies for the delay.

The problem here is that the second tool expects as File the path inside the output of the first tool. So in the example above, the first tool should not be given path_inside.txt but instead the content of that file, which is /my/file.txt.

So in this case, the question is how to connect the standard output of the first tool (/my/file.txt) [which is saved in path_inside.txt] as input to the --in_file argument of the second tool ?

Hello @mrc, if you think there is no simple way to pass the path to an existing file written in a text file (as stdout), do you know if there would be a way to pass it in a different way ?

Again, the output of the first step is a string which is a path to an existing file, so if stdout is used, it is not the generated text file which needs to be passed, but the text string inside that text file (that string is a path).