jaspervdj/patat

Code block replace not working with tee when writing stdin to a file

stark71 opened this issue · 2 comments

When using the tee command to write the standard input to a file in addition to being piped to a command in a code block, the code block's replace functionality doesn't work as expected.

patat:
  eval:
    tee:
      command: tee /tmp/some && do_something_with.sh /tmp/some && echo Done!
      fragment: false
      replace: true
---
# My slide

```tee
Some content
` ``

The following works for me:

---
patat:
  eval:
    tee:
      command: tee ~/foo && cat ~/foo && echo done!
      fragment: false
      replace: true
...

# My slide

```tee
Some content

```

What is not working as expected? What output are you seeing?

Thanks for your response, and for your great project.

Reading your example I just realized my error. In your example "Some content" is rendered twice, one for tee and another for cat, I forgot that tee also writes the stdin in the stdout, that's why I was getting "Some content" and "done!" and not only "done!"

Apologies.