quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.96k stars 326 forks source link

In quarto render, "--output -" is incompatible with "--embed-resources" #7984

Open ning-y opened 11 months ago

ning-y commented 11 months ago

Bug description

In quarto render, simultaneous use of the options --output - and --embed-resources fails with an error (file not found). This error occurs after the HTML file is generated and printed to stdout.

Steps to reproduce

$ touch example.qmd

$ quarto render example.qmd --output -
# ... runs without errors, printing HTML to stdout

$ quarto render example.qmd --output - --embed-resources
# ... the HTML is printed to stdout without issue, but then an error appears:
ERROR: NotFound: No such file or directory (os error 2)

NotFound: No such file or directory (os error 2)
    at Object.readTextFileSync (deno:runtime/js/40_read_file.js:42:16)
    at pandocIngestSelfContainedContent (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:80935:27)
    at file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:81087:27
    at async withTimingAsync (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:19633:25)
    at async Object.complete (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:81082:13)
    at async Object.onPostProcess (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:86678:36)
    at async renderFiles (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:86649:13)
    at async render (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:90681:21)
    at async Command.fn (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:90856:32)
    at async Command.execute (file:///home/ning/miniconda3/envs/togarep/bin/quarto.js:8437:13)

Expected behavior

No error.

Actual behavior

Error.

Your environment

quarto on command line, installed via mamba (from conda-forge).

Quarto check output

$ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.58.3: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.450
      Path: /home/ning/miniconda3/envs/togarep/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.7 (Conda)
      Path: /home/ning/miniconda3/envs/togarep/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
cscheid commented 11 months ago

Thanks for the report! This is a known bug.

Our handling of alternate filenames and directories is not ideal, because a number of different tools have implicit assumptions about the filenames and paths.

As a workaround, you can output to a temporary name and redirect from a wrapper script. Would that not work for your use case?

ning-y commented 11 months ago

@cscheid I have a workaround, no worries! This is more of an "FYI" type of bug report :)