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:

...
outputs:
  file_path:
    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:

inputs:
  in_file:
    type: File
    inputBinding: 
      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

outputs:
  file_path:
    type: File
    streamable: true
    outputBinding:
      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 ?