Skip to content

Commit

Permalink
chore: log watchdog client connection error (#13475)
Browse files Browse the repository at this point in the history
It may happen that the watchdog client started by webpack
fails to connect for some reason, for example when server
socket is bound to ipv4 only and client resolve localhost
with its ipv6 address (e.g. with node 17).
This change adds the detail of the connection error to the
log message, so that debugging this kind of situation may
be simpler.
  • Loading branch information
mcollovati authored Apr 12, 2022
1 parent 039c28f commit 4787818
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flow-server/src/main/resources/vite.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ function updateTheme(contextPath: string) {
function runWatchDog(watchDogPort) {
const client = net.Socket();
client.setEncoding('utf8');
client.on('error', function () {
console.log('Watchdog connection error. Terminating vite process...');
client.on('error', function (err) {
console.log('Watchdog connection error. Terminating vite process...', err);
client.destroy();
process.exit(0);
});
Expand Down
4 changes: 2 additions & 2 deletions flow-server/src/main/resources/webpack.generated.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ if (watchDogPort) {
const runWatchDog = () => {
const client = new require('net').Socket();
client.setEncoding('utf8');
client.on('error', function () {
console.log('Watchdog connection error. Terminating webpack process...');
client.on('error', function (err) {
console.log('Watchdog connection error. Terminating webpack process...', err);
client.destroy();
process.exit(0);
});
Expand Down

0 comments on commit 4787818

Please sign in to comment.