brunosimon / keppler

Real time code sharing for your lectures and presentations.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when editing files with PHPStorm

ADRDev opened this issue · comments

There seems to be an issue when editing files via PHPStorm due to the way it uses temporary files.

app > socket - create_file - .\gulpfile.js___jb_tmp___
watcher - change - .\gulpfile.js
watcher - add - .\gulpfile.js___jb_old___
C:\Users\user\AppData\Roaming\npm\node_modules\keppler\lib\watcher.js:165
                        file.content = data.toString()
                                           ^

TypeError: Cannot read property 'toString' of undefined
    at ReadFileContext.fs.readFile [as callback] (C:\Users\user\AppData\Roaming\npm\node_modules\keppler\lib\watcher.js:165:44)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)

This happens any time you edit a file.

To work around I've excluded files with _jb_ in the name.

Hello,

I installed PhpStorm but I couldn't get those strange files with ___jb_old___ and ___jb_tmp___ at the end. But I tried to fix the problem anyway.

I excluded both *___jb_old___ and *___jb_tmp___ path in the default arguments and I also add support to errors if the file couldn't be read in the watcher (should have been done at start).

I've just published the fix on NPM and git. Don't hesitate if there is still a problem.

Thank you