Skip to content

Commit

Permalink
fix: close the node app when http proxy stream ends (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
davemooreuws committed Apr 26, 2024
1 parent 62d62c7 commit be2bf09
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/resources/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ const createWorker = async (
srv.on('close', () => {
httpProxyStream.cancel();
});

httpProxyStream.on('end', () => {
if (typeof srv.close === 'function') {
srv.close();
} else {
process.exit(1); // Close the Node.js application with a non-zero exit code
}
});
}
};

Expand Down

0 comments on commit be2bf09

Please sign in to comment.