Skip to content

Commit 625e290

Browse files
authored
Merge pull request #13 from sjrd/fix-node-js-17
Fix #12: Force the server and client of Node.js Com to use IPv4.
2 parents f0dc9bd + c27f0b7 commit 625e290

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15+
nodejsversion: ["15"]
1516
scalaversion: ["2.11.12", "2.12.11", "2.13.2"]
1617
project: ["scalajs-js-envs", "scalajs-js-envs-test-kit", "scalajs-env-nodejs"]
18+
include:
19+
- nodejsversion: "16"
20+
scalaversion: "2.12.11"
21+
project: "scalajs-env-nodejs"
22+
- nodejsversion: "17"
23+
scalaversion: "2.12.11"
24+
project: "scalajs-env-nodejs"
1725
steps:
1826
- uses: actions/checkout@v2
1927
- uses: olafurpg/setup-scala@v10
2028
with:
2129
java-version: "[email protected]"
30+
- uses: actions/setup-node@v2
31+
with:
32+
node-version: "${{ matrix.nodejsversion }}"
2233
- uses: coursier/cache-action@v5
2334
- name: Test
2435
run: sbt "++${{ matrix.scalaversion }}" ${{ matrix.project }}/test

nodejs-env/src/main/scala/org/scalajs/jsenv/nodejs/ComSupport.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ object ComRun {
209209
def start(config: RunConfig, onMessage: String => Unit)(startRun: Path => JSRun): JSComRun = {
210210
try {
211211
val serverSocket =
212-
new ServerSocket(0, 0, InetAddress.getByName(null)) // Loopback address
212+
new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1")) // IPv4 loopback address
213213

214214
val run = startRun(setupFile(serverSocket.getLocalPort))
215215

@@ -248,7 +248,7 @@ object ComRun {
248248
s"""
249249
|(function() {
250250
| // The socket for communication
251-
| var socket = require('net').connect($port);
251+
| var socket = require('net').connect($port, '127.0.0.1'); // IPv4 loopback address
252252
|
253253
| // Buffers received data
254254
| var inBuffer = Buffer.alloc(0);

0 commit comments

Comments
 (0)