marp-team / marp-cli

A CLI interface for Marp and Marpit based converters
MIT License
1.85k stars 105 forks source link

Unable to launch marp if a subdirectory or file is not readable #560

Closed lsignac closed 6 months ago

lsignac commented 10 months ago

marp fails if a file is not readable :

$ mkdir Test-marp
$ cd Test-marp/
$ touch secret.md
$ chmod a-r secret.md
$ cat<<EOF > slides.md
> ---
> title: Slides
> ---
> 
> # Firest slide
> 
> EOF
$ marp .
[  INFO ] Converting 2 markdowns...
[ ERROR ] Failed converting Markdown. (EACCES: permission denied, open
          'Test-marp/secret.md')

Deleting secret.md solves the problem. I think (not sure... ;) ) marp should just ignore unreadable files and should not fail.

yhatt commented 10 months ago

Marp CLI has historically been fail fast to avoid passing conversion errors to subsequent processes, such as watch mode, preview mode, etc.

https://github.com/marp-team/marp-cli/blob/04a1bcf6bc850659ae4f8842ca527b4a49436290/src/marp-cli.ts#L358-L372

If we were to refactor the multi-file conversion, we would have to make the error scope file by file, and then pass the conversion success/failure for each file to the subsequent process. :)

It would be good to provide --fail-fast option too, for users who want the traditional workflow.