mogria / rtsh-wetty-cli

A Client for rtsh based on wetty
MIT License
1 stars 0 forks source link

SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data #1

Open wtjerry opened 8 years ago

wtjerry commented 8 years ago

if with the cheatCreateCommand a unit was created, the watcher watching on 'change' produces a lot of events. all for the symlink to this unit. Sometimes either fs.readFile of JSON.parse seems not to be fast enough to read / parse.

mogria commented 8 years ago

Has this commit fixed this issue? https://github.com/mogria/rtsh-wetty-cli/commit/a2f7f38237754eadf09c2740583c22e12bac8ed8 Or the previous one? https://github.com/mogria/rtsh-wetty-cli/commit/626f57fa20a6c16f43dc71b3ca9d70e87c2a8605 In this one no empty files get send so that the JSON.parse in the browser doesn't get an invalid JSON document. Empty files always appeared when a new file got created, because the file system watcher detected it before the python server has written to it.

mogria commented 8 years ago

I think the last commit probably fixed it. It was also related with issue #3. But let's give this a short time of testing so we can say for sure. If this doesn't work correctly we could also try to use the awaitWriteFinish option of chokidar.