Skip to content

Commit

Permalink
Get rid of deprecated fs.existSync
Browse files Browse the repository at this point in the history
Reviewed By: mmahoney

Differential Revision: D2824569

fb-gh-sync-id: efed6e88f566110b8286ea59563c2904b3dd8059
  • Loading branch information
martinbigio authored and facebook-github-bot-8 committed Jan 13, 2016
1 parent 801b83d commit 51621b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packager/react-packager/src/SocketInterface/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;

0 comments on commit 51621b1

Please sign in to comment.