Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
Use 127.0.0.1 instead of localhost (#7)
Browse files Browse the repository at this point in the history
The server already listened on `127.0.0.1`, so we need to make sure the client does too.

Related to mantoni/eslint_d.js#46
  • Loading branch information
josephfrazier authored Jan 8, 2018
2 parents 7d98373 + 388366f commit b4dd7d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ time.
```bash
PORT=`cat ~/.prettier_d | cut -d" " -f1`
TOKEN=`cat ~/.prettier_d | cut -d" " -f2`
echo "$TOKEN $PWD file.js" | nc -q 0 localhost $PORT
echo "$TOKEN $PWD file.js" | nc -q 0 127.0.0.1 $PORT

# You can also pipe a stream in with `--stdin`:
cat file.js | cat <(echo "$TOKEN $PWD --stdin") - | nc -q 0 localhost $PORT
cat file.js | cat <(echo "$TOKEN $PWD --stdin") - | nc -q 0 127.0.0.1 $PORT
# `prettier_dnc` is provided as a helper script for this usage:
cat file.js | prettier_dnc
```
Expand Down
2 changes: 1 addition & 1 deletion bin/prettier_dnc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ else
NC_OPTIONS=""
fi

cat <(echo "$TOKEN $PWD --stdin $@") - | nc $NC_OPTIONS localhost $PORT
cat <(echo "$TOKEN $PWD --stdin $@") - | nc $NC_OPTIONS 127.0.0.1 $PORT
2 changes: 1 addition & 1 deletion lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function connect(callback) {
return callback(Error('Not running'))
}
net
.connect(data.port, function() {
.connect(data.port, '127.0.0.1', function() {
callback(null, this, data.token)
})
.on('error', () => {
Expand Down

0 comments on commit b4dd7d0

Please sign in to comment.