Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] Fix threaded worker blob syntax error #6214

Merged
merged 3 commits into from Mar 15, 2022

Conversation

mattsoulanille
Copy link
Member

@mattsoulanille mattsoulanille commented Mar 10, 2022

JS's Blob replaces "\n" with a newline character. In the threaded worker bundle, there's a "\n" in if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n"). When it is replaced with a newline, it splits a string across multiple lines, which is not valid JavaScript.

This change prevents Blob from doing that replacement by escaping the "\n" character as "\n".

fixes #6203

This was not caught by presubmits because they do not run threaded tests. I'll fix this in another PR.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

JS's Blob replaces "\n" with a newline character. In the threaded worker bundle, there's a "\n" in `if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n")`. When it is replaced with a newline, it splits a string across multiple lines, which is not valid JavaScript.

This change prevents Blob from doing that replacement by escaping the "\n" character as "\\n".

fixes tensorflow#6203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm 3.14.0 tf.setBackend("wasm") got error 'Uncaught SyntaxError: Invalid or unexpected token '
3 participants