Skip to content

Commit

Permalink
Fix error and leak
Browse files Browse the repository at this point in the history
  • Loading branch information
willnode committed Jun 17, 2024
1 parent 36d1ff3 commit 07766db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function init() {
}
if (!port) {
try {
outPort = await getFreePort();
port = await getFreePort();
} catch (err) {
throw new Error("Can't get free port");
}
Expand Down Expand Up @@ -43,11 +43,11 @@ async function init() {

child.on('spawn', () => {
console.log(`Started process ${cmd} with PID ${child.pid}`);

process.on('SIGINT', () => {
child.kill('SIGTERM')
})
});

process.on('exit', () => {
child.kill('SIGTERM')
})
}

return { port, host };
Expand Down
2 changes: 1 addition & 1 deletion util.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const net = require('net');

const MAX_RETRY = 1000;
const MAX_RETRY = 120;
const WAIT_RETRY = 1000; // in milliseconds

/**
Expand Down

0 comments on commit 07766db

Please sign in to comment.