pucelle / vscode-run-on-save

Run configured shell commands when a file is saved in vscode, and output configured messages on status bar.
https://marketplace.visualstudio.com/items?itemName=pucelle.run-on-save
MIT License
50 stars 11 forks source link

'bad option' only when running command through Run on Save #20

Closed Jofkos closed 2 years ago

Jofkos commented 2 years ago

My config is

{
    "match": ".*\\.drawio$",
    "runIn": "backend",
    "command": "draw.io --crop --export -f pdf \"${file}\""
}

when running it, I get

Running "draw.io --crop --export -f pdf "myfile.drawio""
draw.io: bad option: --crop
draw.io: bad option: --export
draw.io: bad option: -f

yet when manually running that exact command (draw.io --crop --export -f pdf "myfile.drawio") in the terminal, it works fine.

What's going on here, and how can I get around this?

//EDIT: It apparently runs node instead of the application specified. No idea why.

Running "draw.io --help"
Usage: node [options] [ script.js ] [arguments]
       node inspect [options] [ script.js | host:port ] [arguments]

Options:
  -                           script read from stdin (default if no
                              file name is provided, interactive mode
                              if a tty)
  --                          indicate the end of node options
  --abort-on-uncaught-exception
                              aborting instead of exiting causes a
                              core file to be generated for analysis
  -c, --check                 syntax check script without executing
[...]

Documentation can be found at https://nodejs.org/
pucelle commented 2 years ago

Thanks, I will check it.

pucelle commented 2 years ago

I tested codes but didn't find any obvious problem, except this plugin will remove " and actually exec "draw.io --crop --export -f pdf myfile.drawio".

I don't know if this caused the issue, but I fixed it and published a small version v1.4.8, you may try it but I don't expect to fix your issue.

pucelle commented 2 years ago

Close because no feedback.