compdb
compdb copied to clipboard
Error while adding headers
Hi, I'm getting an error while using compdb -p ./ list > compile_commands.json
:
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
causing compdb to end with code 1. Any idea what is causing this? Thank you
Same for me.
That happens because compile_commands.json gets modified while compdb is reading from it. You can get around this issue by writing to a temporary file first, e.g:
compdb -p ./ list > temp && mv temp compile_commands.json
Or by using some other method to ensure the command finishes before writing to the compile_commands.json file.