1
0
Fork 0
forked from svrjs/svrjs

Improved Bun workaround

This commit is contained in:
Dorian Niemiec 2023-09-08 20:08:46 +02:00
parent 3edbc80e7d
commit 1e2d61ff64
2 changed files with 24 additions and 22 deletions

View file

@ -3,7 +3,7 @@
"port": 80, "port": 80,
"pubport": 80, "pubport": 80,
"page404": "404.html", "page404": "404.html",
"timestamp": 1694195890852, "timestamp": 1694196507492,
"blacklist": [], "blacklist": [],
"nonStandardCodes": [], "nonStandardCodes": [],
"enableCompression": true, "enableCompression": true,

4
svr.js
View file

@ -223,6 +223,7 @@ if (!singlethreaded) {
function checkSendImplementation(worker) { function checkSendImplementation(worker) {
var sendImplemented = true; var sendImplemented = true;
if (!(process.versions && process.versions.bun && process.versions.bun[0] != "0")) {
if (!worker.send) { if (!worker.send) {
sendImplemented = false; sendImplemented = false;
} }
@ -242,9 +243,11 @@ if (!singlethreaded) {
if (err.message === "NOT IMPLEMENTED") { if (err.message === "NOT IMPLEMENTED") {
sendImplemented = false; sendImplemented = false;
} }
console.log(err);
} }
console.log = oldLog; console.log = oldLog;
}
return sendImplemented; return sendImplemented;
} }
@ -5083,7 +5086,6 @@ function start(init) {
} }
if (!cluster.isPrimary && cluster.isPrimary !== undefined) { if (!cluster.isPrimary && cluster.isPrimary !== undefined) {
process.on("message", function (line) { process.on("message", function (line) {
if(line === undefined) return; // Workaround for Bun 1.0.0
try { try {
if (line == "") { if (line == "") {
// Does Nothing // Does Nothing