Skip to content

Commit

Permalink
Packager - Fix symbolicate on windows
Browse files Browse the repository at this point in the history
Summary:
There was an error with packager symbolization on Windows because it looks like `allowHalfOpen: true` doesn't work properly when using named sockets. This uses a random port on localhost for the connection instead on Windows as a workaround.

**Test plan**
Tested that symbolization works on both mac and windows by triggering a warning in UIExplorer.
Closes facebook#13828

Differential Revision: D5019537

Pulled By: davidaurelio

fbshipit-source-id: 62c5b5f270e553a7d413bb4d1bab2406380f1d4f
  • Loading branch information
janicduplessis authored and facebook-github-bot committed May 8, 2017
1 parent 5058e7e commit 074fd33
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packager/src/Server/symbolicate/symbolicate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const affixes = {prefix: 'metro-bundler-symbolicate', suffix: '.sock'};
const childPath = require.resolve('./worker');

exports.createWorker = (): Symbolicate => {
const socket = xpipe.eq(temp.path(affixes));
// There are issues with named sockets on windows that cause the connection to
// close too early so run the symbolicate server on a random localhost port.
const socket = process.platform === 'win32'
? 34712
: xpipe.eq(temp.path(affixes));
const child = new LockingPromise(new LazyPromise(() => startupChild(socket)));

return (stack, sourceMaps) =>
Expand All @@ -53,6 +57,7 @@ function startupChild(socket) {
child.removeAllListeners();
resolve(child);
});
// $FlowFixMe ChildProcess.send should accept any type.
child.send(socket);
});
}
Expand Down

0 comments on commit 074fd33

Please sign in to comment.