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 issue 'unexpected end of input' error in call function by JSON.parse #6

Closed payousefi closed 6 years ago

payousefi commented 7 years ago

Referenced in issue #5

patrickcze commented 7 years ago

This is an important bug fix that should be accepted as it resolves an issue with async calls

andru commented 6 years ago

Async is very broken without this fix. I'm currently using payousefi's fork in production code. @joshkatz please merge this.

andru commented 6 years ago

🙌🏼

ccornchip commented 3 years ago

Unfortunately, this causes an a fatal error when R encounters an exception:

body === "" as nothing is in stdout (it all goes to stderr) then when the callback child.on('close', ...) is called, it causes an 'unexpected end of input' error in function by JSON.parse

I think this can be fixed by https://github.com/joshkatz/r-script/pull/7