Skip to content

Commit 8650f1e

Browse files
authored
Handle errors getting the IP
Should help facebook/create-react-app#3690
1 parent 5227c34 commit 8650f1e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/detect-port.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@ function tryListen(host, port, maxPort, callback) {
7272
}
7373

7474
// 4. check current ip
75-
listen(port, address.ip(), (err, realPort) => {
75+
let ip;
76+
try {
77+
ip = address.ip()
78+
} catch (err) {
79+
return handleError(err)
80+
}
81+
82+
listen(port, ip, (err, realPort) => {
7683
if (err) {
7784
return handleError(err)
7885
}

0 commit comments

Comments
 (0)