Closed cart closed 9 years ago
This looks good and what you say makes perfect sense. I'd like to get @alkama 's opinion though, since he's written most of the code that's currently in the lib at this point.
It's good to me! (Was to be expected that opening a new temp file for each keystroke would have limits.) Thanks for the patch @mcanders :)
After using atom-racer for awhile in one session, I get an EMFILE error from atom-racer, then the error: "Cannot read property 'setEncoding' of undefined" on line 124 of file /usr/share/atom/resources/app/src/buffered-process.js . EMFILE errors correspond to having too many files open. It appears that temp.track() only removes the files it created by temp.open() when the process exists, it doesn't automatically close the files while the process is till running. So if you run atom-racer repeatedly, the amount of open files will increase until your o.s. limit is reached. Additionally, in the event of a temp.open() error, racer should not be run because it will not have a valid file to read. I added a fs.close() after fs.writeFileSync() and I haven't seen the error. I also ensured that racer is only called if temp successfully opens a file.