joshkatz / r-script

A simple little module for passing data from NodeJS to R (and back again).
MIT License
161 stars 67 forks source link

Fix for -- SyntaxError: Unexpected end of input #5

Open payousefi opened 7 years ago

payousefi commented 7 years ago

Hi -- not sure if this is still being managed, but I ran into this error and have a fix for it that might help others.

I was running a couple different R scripts that took a little longer to complete. I would receive an Unexpected end of input error, and the log of the actual data was a .

I concluded I was receiving the 'unexpected end of input' error because JSON.parse couldn't parse the string buffer being passed in from the data received from R via Node's child_process.spawn -- so I attempted concatenating the chunks of the data and then running the callback on close instead, and that fixed my issue!

It's possible I was receiving this error for another reason (and if anyone has other ideas, that would be useful), but I'll make a pull request referencing this issue in case it's something you think would be required for others.

ss50 commented 7 years ago

I'm also experiencing the same issue - have you gotten your pull request reviewed??