Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while adding headers #26

Open
BSB47 opened this issue Apr 25, 2022 · 2 comments
Open

Error while adding headers #26

BSB47 opened this issue Apr 25, 2022 · 2 comments

Comments

@BSB47
Copy link

BSB47 commented Apr 25, 2022

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

@afrischk
Copy link

afrischk commented May 6, 2022

Same for me.

@alpha-alpha-alpha
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants