demonnic / muddler

A build tool for Mudlet package developers
MIT License
40 stars 12 forks source link

[DEBUG:] Error loading output file, err: InvalidJSONInput: parse error: premature EOF #36

Open cizra opened 5 months ago

cizra commented 5 months ago

When rebuilding a project that's open in Mudlet, Mudlet shows this error message:

[DEBUG:] Error loading output file, err: InvalidJSONInput: parse error: premature EOF

                     (right here) ------^
 at lua_yajl.c line 318
[DEBUG:] preremove cofudlet
[DEBUG:] postremove cofudlet
[DEBUG:] preinstall cofudlet
[DEBUG:] postinstall cofudlet
[DEBUG:] Done reloading pkg cofudlet

I suspect this is probably caused by muddler writing directly into .output. This truncates the file, which Mudlets reacts on, before adding the new content.

To make this process atomic, create a new temporary file somewhere in the same directory (or at least filesystem), then rename the temp file into .output, overwriting the original.