diff --git a/react-packager/src/SocketInterface/index.js b/react-packager/src/SocketInterface/index.js index e2d70bbf..69b52a4f 100644 --- a/react-packager/src/SocketInterface/index.js +++ b/react-packager/src/SocketInterface/index.js @@ -49,7 +49,7 @@ const SocketInterface = { sockPath = '\\\\.\\pipe\\' + sockPath } - if (fs.existsSync(sockPath)) { + if (existsSync(sockPath)) { var sock = net.connect(sockPath); sock.on('connect', () => { SocketClient.create(sockPath).then( @@ -135,4 +135,13 @@ function createServer(resolve, reject, options, sockPath) { }); } +function existsSync(filename) { + try { + fs.accessSync(filename); + return true; + } catch(ex) { + return false; + } +} + module.exports = SocketInterface;