simonhaenisch/md-to-pdf

Wildcard file paths not working on Windows cmd.exe

anushibin007 opened this issue · 3 comments

Context:

  • version (md-to-pdf -v): 5.1.0
  • platform (Unix, macOS, Windows): Windows
  • node version: 14.17.3

Running md-to-pdf ./*.md on Windows yields a no such file or directory error.

Steps to reproduce:

  1. On Windows, open CMD in a directory where there are md files present.
  2. Run the command md-to-pdf ./*.md.

Expected:
All the md files in the current directory should get converted to PDF.

Actual:
The operation fails with the following error:

  × generating PDF from .\*.md
    → ENOENT: no such file or directory, open 'C:\docs\*.md'
ListrError: Something went wrong
    at C:\Users\user\AppData\Roaming\nvm\v14.17.3\node_modules\md-to-pdf\node_modules\listr\index.js:102:18
    at async main (C:\Users\user\AppData\Roaming\nvm\v14.17.3\node_modules\md-to-pdf\dist\cli.js:118:5) {
  errors: [
    [Error: ENOENT: no such file or directory, open 'C:\docs\*.md'] {
      errno: -4058,
      code: 'ENOENT',
      syscall: 'open',
      path: 'C:\\docs\\*.md'
    }
  ],
  context: [Object: null prototype] {}
}

It's not a bug, cmd.exe doesn't support wildcard expansion (link). Nowadays you should be able to use a linux sub-system on Windows, or you can try PowerShell, I guess.

baba43 commented

I think that a CLI should support the most used operation system either.

The CLI supports Windows as you can see in the CI (e.g. here). How exactly to get a list of file paths to pass as arguments is obviously dependent on the shell you use.