From 074fd33725626530c68d897150413a13715280a1 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 8 May 2017 04:15:35 -0700 Subject: [PATCH] Packager - Fix symbolicate on windows 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 https://github.com/facebook/react-native/pull/13828 Differential Revision: D5019537 Pulled By: davidaurelio fbshipit-source-id: 62c5b5f270e553a7d413bb4d1bab2406380f1d4f --- packager/src/Server/symbolicate/symbolicate.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packager/src/Server/symbolicate/symbolicate.js b/packager/src/Server/symbolicate/symbolicate.js index 3ea3c08979ce97..f4fd96363e95ab 100644 --- a/packager/src/Server/symbolicate/symbolicate.js +++ b/packager/src/Server/symbolicate/symbolicate.js @@ -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) => @@ -53,6 +57,7 @@ function startupChild(socket) { child.removeAllListeners(); resolve(child); }); + // $FlowFixMe ChildProcess.send should accept any type. child.send(socket); }); }