mixn / carbon-now-cli

🎨 Beautiful images of your code — from right inside your terminal.
MIT License
5.77k stars 121 forks source link

can not run multiple commands in parallel #212

Open EcoFreshKase opened 6 months ago

EcoFreshKase commented 6 months ago

Describe the bug Running multiple carbon-now commands simultaneously in the same directoy can cause problems with renaming the output file. It seems like the output file is firstly saved as carbon.png and later renamed to the string specified in the --save-as flag. The output file could have the name specified in --save-as from the beginning, with no need to rename it later.

To Reproduce Steps to reproduce the behavior:

  1. Clone this repository
  2. run npm i
  3. run npm start (might have to be executed multiple times)

Sometime a conversions failes with the following error:

Error while converting test/main.py: Error: Command failed: npx carbon-now test/main.py --save-as test-main.py --save-to .\exports
✖ Fetching beautiful image [FAILED: ENOENT: no such file or directory, rename '~\exports\carbon.png' -> '~\exports\test-main.py.png']

  Error: Sending code to https://carbon.now.sh went wrong.

  This is mostly due to:

  · Nonsensical input like `--start 10 --end 2`
  · Carbon being down or taking too long to respond
  · Your internet connection not working or being too slow

  Additional info:

  ENOENT: no such file or directory, rename '~\exports\carbon.png' -> '~\exports\test-main.py.png'

Expected behavior All commands should be able to run in parallel.

Info (please complete the following information):

Code snippet
  
mixn commented 4 months ago

Hey @EcoFreshKase, thanks for opening. Been quite swamped since the beginning of the year, but I will tackle a new release of the CLI soon and, amongst other things, address this. 🙂 Thanks for your patience, appreciated!

P. S.: Nice user name, haha.