-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hack around node windows unicode bug (#687)
- Loading branch information
Showing
3 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
global.fs
monkey patched on all platforms - not just Windows?93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I decided to do that because they should be equivalent and doing this on all platforms increases the test coverage of this patch. If there's something that isn't equivalent about this change, it'd be good to know sooner rather than later.
Note that the
global
variable is only the global object when running viaesbuild-wasm/bin/esbuild
, which is always run in a child process viaexecFile()
since it callsprocess.exit()
. So this variable won't be accessible from the host process when using esbuild's JavaScript API from node. And when running in the browser, theglobal
variable is a clone of the global object instead for safety, so it's not accessible when using esbuild's JavaScript API in the browser either:esbuild/lib/browser.ts
Lines 39 to 46 in b8f1e7b
93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call... 64KB buffer boundary heisenbug found on Mac built from b8f1e7b:
Curiously, when stdout redirected to file, it's okay:
93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The esbuild-wasm problem does not appear with binaries built from 88c8523.
93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. I'm guessing
process.stdout.write()
isn't synchronous like I thought it was. Go reaches the end ofmain
and callsexit(0)
beforeprocess.stdout.write()
finishes, thus causing us to exit the process while node is still writing to stdout. I think adding a callback toprocess.stdout.write()
should fix this.93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be addressed by 392241b.
93423e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is published as 0.8.36. Thank you very much for the bug report.